app:transformDexArchiveWithExternalLibsDexMergerForDebug在Android Studio 3.0.1中

san*_*sen 7 android dex android-gradle-plugin appium-android

Message Gradle构建:

错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。

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

这是gradle构建文件:

apply plugin: 'com.android.application'

    android {

        compileSdkVersion 26
        defaultConfig {

            minSdkVersion 26
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true

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

    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/bsh-core-2.0b4.jar')
        implementation files('libs/selenium-java-2.3.0.jar')
        implementation files('libs/selenium-remote-driver-3.0.0.jar')
        // https://mvnrepository.com/artifact/io.appium/java-client
        implementation  group: 'io.appium', name: 'java-client', version: '5.0.4'

    }
Run Code Online (Sandbox Code Playgroud)

小智 3

在你的文件上试试这个build.gradle(Module: app)

android {
    defaultConfig 
    {
        ...
        multiDexEnabled true
    }
}
Run Code Online (Sandbox Code Playgroud)