1. 程式人生 > >com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex解決

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

如果您的Studio是3.0.1,並且您的gradle使用的是3.0.1,如下

 dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1' 
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

你並且設定了multiDexEnabled true依賴了這個implementation 'com.android.support:multidex:1.0.3' ,那麼出現

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

> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

這個問題請您檢查buildTypes release、debug裡是否設定了debuggable true,如果沒有請加上問題就解決了。

 buildTypes {
        release {
            debuggable true  // *****
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }