skip to Main Content

After upgrading to flutter 3.19.0 i am getting the following error while running my application on android it is working fine on ios and when i open only android directory in android studio and run the project in that case also it is working fine.

ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform firebase-auth-22.3.1.aar (com.google.firebase:firebase-auth:22.3.1) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /home/munsif/.gradle/caches/transforms-3/ba579288272952d282e3eb784bb3facc/transformed/jetified-firebase-auth-22.3.1-runtime.jar.
         > Error while dexing.
   > Failed to transform play-services-location-21.1.0.aar (com.google.android.gms:play-services-location:21.1.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /home/munsif/.gradle/caches/transforms-3/c40ae925c2dff28a07b701244ea18adb/transformed/jetified-play-services-location-21.1.0-runtime.jar.
         > Error while dexing.
   > Failed to transform recaptcha-18.4.0.aar (com.google.android.recaptcha:recaptcha:18.4.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /home/munsif/.gradle/caches/transforms-3/6a9b2598905fd8f95f3e5a4db9115179/transformed/jetified-recaptcha-18.4.0-runtime.jar.
         > Error while dexing.
   > Failed to transform kotlin-stdlib-1.9.0.jar (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /home/munsif/.gradle/caches/transforms-3/ae0183353754275aa55a66ddf2de48d6/transformed/jetified-kotlin-stdlib-1.9.0.jar.
         > Error while dexing.

I tried adding these to gradle.properties

android.useAndroidX=true
android.enableJetifier=true

enabling multiDex like this in build.gradle:

android {
    defaultConfig {
        ...
        multiDexEnabled true
    }
}

add this line to build.gradle

implementation 'com.android.support:multidex:1.0.3'

all these methods didn’t solved my problem:
any solution for this problem?

2

Answers


  1. Chosen as BEST ANSWER

    Changing the compileSdkVersion solved my problem.

    I changed compileSdkVersion in android/app/build.gradle

    From

     compileSdkVersion flutter.compileSdkVersion
    

    TO

    compileSdkVersion 33
    

    and the error gone.


  2. What sort of gradle version are you running? Im having the same issue, tried your changes but no luck.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search