错误java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex

时间:2018-01-15 11:57:59

标签: java android

我的项目在Android Studio 3.0.1上的Whatchap中,这是我的设计方法。 build.gradle(app)         申请插件:' com.android.application'

android {
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    compileSdkVersion 26
    defaultConfig {
        applicationId "stmik.iax.whatchap"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildToolsVersion '26.0.2'
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation files('libs/sun.misc.BASE64Decoder.jar')
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.google.android.gms:play-services-gcm:11.2.0'
}

模块Gradle

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'


                }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的问题

  

错误:任务执行失败   ':应用程序:transformDexArchiveWithExternalLibsDexMergerForDebug'

     
    

java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并     DEX

  

我一直在尝试 清洁项目 2.重建项目 添加multiDexEnabled true

它无法解决我的问题

1 个答案:

答案 0 :(得分:1)

  

java.lang.RuntimeException:java.lang.RuntimeException:   com.android.builder.dexing.DexArchiveMergerException:无法合并   DEX

您应该升级 gms:play-service 版本。

   implementation 'com.google.android.gms:play-services:11.4.0'

之后, Clean-Rebuild-Run

<强> FYI

检查 gms:play-services 版本。阅读Release Notes