【问题标题】:Error:Execution failed for task app:transformClassesWithMultidexlistForDebug'错误:任务应用程序执行失败:transformClassesWithMultidexlistForDebug'
【发布时间】:2018-11-08 22:05:48
【问题描述】:

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

错误:任务 ':app:transformClassesWithMultidexlistForDebug' 执行失败。 > java.io.IOException: Can't write [D:\android\projects\android-client\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [D:\android\ projects\android-client\app\build\intermediates\transforms\desugar\debug\47.jar(;;;;;;**.class)] (重复的 zip 条目 [47.jar:android/support/design/widget /CoordinatorLayout$Behavior.class]))

这是我的build.gradle 文件:

apply plugin: 'com.android.application'

android {
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 "android.support.test.runner.AndroidJUnitRunner"
    manifestPlaceholders = [manifestApplicationId          : "",
                            onesignal_app_id               : "",
                            onesignal_google_project_number: ""]
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}
}

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.0-beta1'
    compile 'com.google.android.gms:play-services-plus:15.0.1'
    compile 'com.google.android.gms:play-services-analytics:15.0.2'
    compile 'com.google.android.gms:play-services-nearby:15.0.1'
    compile 'com.google.android.gms:play-services-maps:15.0.1'
    compile 'com.google.android.gms:play-services-places:15.0.1'
    compile 'com.google.android.gms:play-services-location:15.0.1'
    compile 'com.google.android.gms:play-services-gcm:15.0.1'
    compile 'com.google.android.gms:play-services-base:15.0.1'
    compile 'com.google.firebase:firebase-messaging:15.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.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.android.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.android.support:multidex:1.0.3'
    compile 'com.android.support:support-compat:26.1.0'
    compile 'com.daimajia.easing:library:2.0@aar'
    compile 'com.daimajia.androidanimations: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.android.support:support-core-ui:26.4.0"
    implementation 'com.rahnema.vas3gapi:vas3g-api:2.0.0'

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

【问题讨论】:

    标签: java android gradle


    【解决方案1】:

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

    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 的一个版本。不要使用测试版。

    【讨论】:

      【解决方案2】:

      我认为你没有添加依赖。

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

      【讨论】:

      • 我已经添加了这一行,并且在配置中启用了 multi dex 是真的
      猜你喜欢
      • 2016-10-20
      • 2020-04-29
      • 2016-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-26
      • 2016-10-30
      • 1970-01-01
      相关资源
      最近更新 更多