Skip to content Skip to sidebar Skip to footer

Execution Failed For Task ':app:checkdebugduplicateclasses'. Ionic4 Android

I'm currently working on an ionic4 application, but recently it stopped working while building the application on an android reall device after adding https://ionicframework.com/do

Solution 1:

  1. Go to gradle.properties(project properties)

  2. Add android.enableJetifier=true

  3. And also most of time android.useAndroidX=true is present.Check your gradle.properties(Project Properties) and if it does not exist then add android.useAndroidX=true -> Look Likes This Image

enter image description here

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:

  1. Ensure the ANDROID_HOME environment-variable is set, and then, open a console window (like git-bash, because it keeps the whole command output), and cd into your android directory (for Ionic projects it should be platforms/android).
  2. First, List all dependencies by running below (in git-bash):
    ./gradlew :app:dependencies
  3. Copy the result into your preferred text-editor, and search for androidx.
  4. If you found something follow below steps, else you are done! (and you do not need to repeat these steps).
  5. 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 +).
  6. 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.
  7. 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 :

  1. Go to gradle.properties files

  2. Add these two lines :

    android.useAndroidX=trueandroid.enableJetifier=true
  3. 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"