应用程式:transformClassesWithMultidexlistForDebug'

时间:2018-03-05 03:11:05

标签: java android android-studio android-multidex

我遇到了这个错误

  

应用程式:transformClassesWithMultidexlistForDebug&#39 ;. > java.io.IOException:无法写[AppFinal \ app \ build \ intermediates \ multi-dex \ debug \ componentClasses.jar](无法读取[.gradle \ caches \ transforms-1 \ files- 1.1 \ support-core-ui-27.1.0.aar \ 1e1d11e393fd1de952998ec34dc775f1 \ jars \ classes.jar(;;;;;; **。class)](重复的zip条目[classes.jar:android / support / design / widget /CoordinatorLayout$Behavior.class]))

这是我的build.gradle(module:app)

    apply plugin: 'com.android.application'
    apply plugin: 'io.fabric'


android {
compileSdkVersion 26
defaultConfig {
    multiDexEnabled true
    applicationId ""
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
    javaMaxHeapSize "4g"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation 'com.android.support:support-v4:27.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
    transitive = true
}
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-ads:11.8.0'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:support-vector-drawable:26.+'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'id.zelory:compressor:2.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
implementation 'com.github.medyo:fancybuttons:1.8.4'
implementation   "com.github.bumptech.glide:okhttp3-integration:4.6.1"
}






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

这是我的build.grad代码(项目:app)

buildscript {

repositories {
    google()
    jcenter()
    maven {
        url 'https://maven.fabric.io/public'
    }
}
dependencies {

    classpath 'io.fabric.tools:gradle:1.24.4'
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.2.0'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    google()
    jcenter()
    maven {
        url 'https://maven.fabric.io/public'
    }
}
}

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

我在重建项目时遇到此错误

1 个答案:

答案 0 :(得分:0)

您已经添加了com.android.support:design个依赖关系三次,只保留一次也为所有依赖项使用相同的版本。

dependencies {
implementation 'com.android.support:support-v4:27.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
    transitive = true
}
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-ads:11.8.0'
implementation 'com.android.support:support-vector-drawable:27.1.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'id.zelory:compressor:2.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:27.1.0'
implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
implementation 'com.github.medyo:fancybuttons:1.8.4'
implementation   "com.github.bumptech.glide:okhttp3-integration:4.6.1"
}