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

时间:2018-05-30 06:53:21

标签: java android gradle

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

  

错误:任务':app:transformClassesWithMultidexlistForDebug'执行失败。 > java.io.IOException:不能写[D:\ android \ projects \ android-client \ app \ build \ intermediates \ multi-dex \ debug \ componentClasses.jar](不能读[D: \ android \ projects \ android-client \ app \ build \ intermediates \ transforms \ desugar \ debug \ 47.jar(;;;;;; **。class)](重复的zip条目[47.jar:android / support /设计/插件/ 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'

2 个答案:

答案 0 :(得分:0)

我认为您尚未添加依赖项。

dependencies {
  compile 'com.android.support:multidex:1.0.3'
}

please add it and rebuild the project.I hope it will be work

答案 1 :(得分:0)

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

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