Android Studio 3.0 Execution failed for task: unable to merge dex

前端 未结 26 3322
野性不改
野性不改 2020-11-27 11:52

android studio was getting build error while build execution with following:

Error:Execution failed for task \':app:transformDexArchiveWithExternalLi

相关标签:
26条回答
  • 2020-11-27 12:20

    For me, adding

    multiDexEnabled true
    

    and

    packagingOptions {
            exclude 'META-INF/NOTICE' 
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/notice'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license'
            exclude 'META-INF/license.txt'
        }
    

    into the app level Build.gradle file solved the issue

    0 讨论(0)
  • 2020-11-27 12:20

    I tried many solutions as mentioned above including the multiDexEnabled true but none of that worked for me.

    Here is the solution which worked for me - copy this code in app\build.gradle file

    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support' && requested.name != 'multidex') {
                details.useVersion "${rootProject.ext.supportLibVersion}"
            }
        }
    }
    

    Make sure to run gradlew clean before running the code

    0 讨论(0)
提交回复
热议问题