Execution Failed For Task ':app:checkdebugduplicateclasses'. Ionic4 Android
Solution 1:
Solution 2:
Your project (or one of its sub-projects) is referring to a dependency using a + (plus-sign) at its end, like com.google.firebase:firebase-auth:+
, which means, use any higher version when possible, and that newer version is no longer using android.support
libraries and instead is using androidx
; to fix this issue follow the below steps.
Steps:
- Ensure the
ANDROID_HOME
environment-variable is set, and then, open a console window (like git-bash, because it keeps the whole command output), andcd
into yourandroid
directory (for Ionic projects it should beplatforms/android
). - First, List all dependencies by running below (in git-bash):
./gradlew :app:dependencies
- Copy the result into your preferred text-editor, and search for
androidx
. - If you found something follow below steps, else you are done! (and you do not need to repeat these steps).
- Scroll up until you see -> at the end of any line, like for example
16.0.8 -> 19.0.0
or+ -> 19.0.0
, which both mean that the version was auto-resolved (to something higher than specified by you because of +). - So, set the version down manually:
- When possible, in your project find and replace the + sign with a specific version.
- Or, force a specific version of the dependencies like mentioned below.
- At last, repeat above steps (but instead of step one just
clear
the console).
To Force specific version of the dependencies add to your root build.gradle
something like below (which is what worked for me) but edit and add your own rules (if these do not work for you):
allprojects {
// ...
configurations.all {
resolutionStrategy {
force 'com.google.firebase:firebase-common:17.0.0'
force 'com.google.android.gms:play-services-basement:16.2.0'
force 'com.google.firebase:firebase-iid:16.0.0'
force 'com.google.firebase:firebase-auth:17.0.0'
}
}
}
Solution 3:
I came across the same problem and My solution is as follows :
Go to gradle.properties files
Add these two lines :
android.useAndroidX=trueandroid.enableJetifier=true
Rebuild your project.
that's it.
Note: If your project already shows this android.useAndroidX=true
then Just add android.enableJetifier=true
and rebuild your project.
Solution 4:
For me, just installing the plugins "cordova-plugin-androidx" and "cordova-plugin-androidx-adapter" solved this problem:
$ ionic cordova plugin add cordova-plugin-androidx
$ ionic cordova plugin add cordova-plugin-androidx-adapter
Solution 5:
I had this issue when I migrated to Androidx using the Android Studio feature but at the first time the migration was not successful so each time I tried to compile I ran into this issue.
To resolve this issue, I did the following:
[1] Comment all androidx dependencies in the app bundle.gradle file
[2] Try the Migrate to Androidx. You can see this link in Refactor -> Migrate to Androidx. If the migration was successful, then
[3] Uncomment all androidx dependencies in the app bundle.gradle file
You may clean and build your project again, hopefully this error should disappear.
Post a Comment for "Execution Failed For Task ':app:checkdebugduplicateclasses'. Ionic4 Android"