Duplicate R.class after renaming package name for my Android Studio Flutter app
Tried renaming my Android Studio flutter app package, and it is tunring out as a mess. How can I solve this issue?
Build is failing with the error message:
Execution failed for task ':app:multiDexListDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Error while merging dex archives:
Type com.xxxxx.R is defined multiple times:
....\AndroidStudioProjects\xxxx\build\app\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar: D8: Type com.xxxx.R is defined multiple times: ....\AndroidStudioProjects\xxxx\build\app\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar:com/xxxx/R.class, ....\AndroidStudioProjects\xxxx\build\app\intermediates\javac\debug\classes\com\xxxx\R.class
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Solution 1:
Try to run flutter clean
in the terminal first. Or remove /build
directory by yourself manually.