Home > Mobile >  Execution failed for task ':app:multiDexListDebug'
Execution failed for task ':app:multiDexListDebug'

Time:03-16

Please can anyone help me in my issue I got this exception but I don't know why and I can't fix it

Execution failed for task ':app:multiDexListDebug'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: com.share.albir.MainActivity

 defaultConfig {
        applicationId "com.share.albir"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation project(path: ':oppwa.mobile')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.google.android.gms:play-services-wallet:16.0.1'
}

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
android.enableDexingArtifactTransform=false
org.gradle.parallel=false

Note that : I'm not used firebase in my app and this solution not working for me enter link description here

CodePudding user response:

Try the following step:

1. File-> Invalidate Cache -> Invalidate & Restart


 2.Go to android/app/build.gradle and add the following lines of codes:

dependencies {
   implementation 'com.android.support:multidex:2.0.1' //enter the latest multidex version
 }
android {
defaultConfig {
    multiDexEnabled true
  }
}

 3.flutter upgrade

Thank you,

CodePudding user response:

The issue was gone when I put this two lines

minifyEnabled false 
shrinkResources false
  • Related