Android Studio 3.0 Unable to merge dex

前端 未结 6 2059
遇见更好的自我
遇见更好的自我 2020-12-31 12:13

Just Updated android studio from 2.3.3 to 3.0 now I am having the error

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


        
6条回答
  •  清酒与你
    2020-12-31 12:32

    I looked up:

    Error:Execution failed for task ':memDicez:transformDexArchiveWithExternalLibsDexMergerForDebug'.
    

    com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

    yesterday and found nothing usefull,

    my issue is now solved,

    this method might get you towards a solution (it worked for me, no guarantee it works for you)

    I had:

    android {
        compileSdkVersion 25
        buildToolsVersion '26.0.2'
    
        defaultConfig {
            applicationId "(my secret applicationId)"
            minSdkVersion 21
            targetSdkVersion 25
            multiDexEnabled true
        }
    
        ...
    
    }
    

    and

    dependencies {
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support:support-v4:25.3.1'
        compile 'ch.acra:acra:4.9.2'
        //compile 'com.google.android.gms:play-services-auth:9.0.0'
        compile 'com.loopj.android:android-async-http:1.4.9'
        compile 'com.koushikdutta.ion:ion:2.+'
        compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
    }
    

    and when I changed:

            minSdkVersion 21
    

    to

            minSdkVersion 16
    

    I got a more descriptive error message which did give solutions via google/stack overflow.

    in my case

    compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
    

    should be changed to

    compile('com.googlecode.json-simple:json-simple:1.1.1') {
        exclude group: 'org.hamcrest', module: 'hamcrest-core'
    }
    

    You can change the minSdkVersion back to a higher value later on but decreasing it seems to give a more descriptive (or more googleable) problem (and solution)

    cheers,

    S.

提交回复
热议问题