有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java错误:任务app:transformClassesWithMultidexlistForDebug'的执行失败

我在项目中添加了一些依赖项,当我运行它时,此错误显示:

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > java.io.IOException: Can't write [D:\安卓\projects\安卓-client\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [D:\安卓\projects\安卓-client\app\build\intermediates\transforms\desugar\debug\47.jar(;;;;;;**.class)] (Duplicate zip entry [47.jar:安卓/support/design/widget/CoordinatorLayout$Behavior.class]))

这是我的build.gradle文件:

apply plugin: 'com.安卓.application'

安卓 {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
    applicationId "com.arizeh.arizeh"
    minSdkVersion 17
    targetSdkVersion 22
    multiDexEnabled true
    versionCode 31
    versionName "3.0.5"
    useLibrary 'org.apache.http.legacy'
    testInstrumentationRunner "安卓.support.test.runner.AndroidJUnitRunner"
    manifestPlaceholders = [manifestApplicationId          : "",
                            onesignal_app_id               : "",
                            onesignal_google_project_number: ""]
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-安卓.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}
}

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    安卓TestCompile('com.安卓.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.安卓.support', module: 'support-annotations'
    })
    compile 'com.安卓.support:appcompat-v7:26.0.0-beta1'
    compile 'com.google.安卓.gms:play-services-plus:15.0.1'
    compile 'com.google.安卓.gms:play-services-analytics:15.0.2'
    compile 'com.google.安卓.gms:play-services-nearby:15.0.1'
    compile 'com.google.安卓.gms:play-services-maps:15.0.1'
    compile 'com.google.安卓.gms:play-services-places:15.0.1'
    compile 'com.google.安卓.gms:play-services-location:15.0.1'
    compile 'com.google.安卓.gms:play-services-gcm:15.0.1'
    compile 'com.google.安卓.gms:play-services-base:15.0.1'
    compile 'com.google.firebase:firebase-messaging:15.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.安卓.support:design:26.1.0'
    compile 'com.安卓.support:cardview-v7:26.1.0'
    compile 'uk.co.chrisjenx:calligraphy:2.1.0'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.koushikdutta.ion:ion:2.+'
    compile 'com.安卓.support:percent:26.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.shawnlin:number-picker:2.4.2'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    compile 'com.安卓.support:multidex:1.0.3'
    compile 'com.安卓.support:support-compat:26.1.0'
    compile 'com.daimajia.easing:library:2.0@aar'
    compile 'com.daimajia.安卓animations:library:2.2@aar'

    compile 'com.zarinpal:purchase:0.0.3-beta'

    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile "com.安卓.support:support-core-ui:26.4.0"
    implementation 'com.rahnema.vas3gapi:vas3g-api:2.0.0'

}
apply plugin: 'com.google.gms.google-services'

共 (2) 个答案

  1. # 1 楼答案

    我认为您没有添加依赖项

    dependencies {
      compile 'com.android.support:multidex:1.0.3'
    }
    
    please add it and rebuild the project.I hope it will be work
    
  2. # 2 楼答案

    您需要使用相同版本的支持库。在依赖项块中,添加多个版本的支持库:

    compile 'com.android.support:appcompat-v7:26.0.0-beta1'
    compile 'com.android.support:design:26.1.0'
    compile "com.android.support:support-core-ui:26.4.0"
    

    只使用一个版本26.1.026.4.0。不要使用测试版