繁体   English   中英

Android:错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败

[英]Android: Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'

尝试运行项目时遇到错误

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/DimenRes.class

这是我的build.gradle

apply plugin: 'com.android.application'



 android {
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion "24.0.0"
    compileOptions.encoding = 'windows-1251'
    defaultConfig {
        applicationId "org.radiomango.app"
        minSdkVersion 11
        targetSdkVersion 23
        multiDexEnabled true
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles 'proguard.cfg'
        }
    }
    }

    dependencies {
    compile 'com.google.code.gson:gson:2.2.2'
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/android-support-v13.jar')
    compile files('libs/org.apache.commons.httpclient.jar')
    compile files('libs/org.apache.http.legacy.jar')
    compile project(':seekArc_library')
    compile project(':socialauthandroid')
    compile project(':SwipeMenuListView')
    compile 'com.android.support:design:24.0.0'

}

我尝试通过清理项目

构建->清洁

重建之后 ,但没有效果

同步并清理了项目,仍然没有结果。

最后,我重新启动了android studio,但问题仍然令人兴奋。

谁能帮帮我吗

我认为这是因为您使用compile files('libs/android-support-v13.jar')compile 'com.android.support:design:24.0.0'可能是因为此库相互冲突

排除这两个库中共有的库的一部分。 使用exclude例如

compile('com.commonsware.cwac:camera-v9:0.5.4') {
  exclude module: 'support-v4'
}

更换

compile files('libs/android-support-v13.jar')

com.android.support:support-v13:24.0.0

您添加了设计库,该库也利用了support-v4库。 如果同时通过maven-dependency进行添加,则应由gradle处理。

更换

compile files('libs/android-support-v13.jar')

com.android.support:support-v13:24.0.0

在gradle中应用此内容,还添加PackagingOptions

 apply plugin: 'com.android.application'

android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "24.0.0"
compileOptions.encoding = 'windows-1251'
defaultConfig {
    applicationId "org.radiomango.app"
    minSdkVersion 11
    targetSdkVersion 23
    multiDexEnabled true
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

  packagingOptions {
    exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
    exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles 'proguard.cfg'
    }
}
}

dependencies {
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/acra-4.5.0.jar')
compile 'com.android.support:appcompat-v7:23.4.0'
complie  `com.android.support:support-v13:24.0.0` //or you used  23.4.0 
compile files('libs/org.apache.commons.httpclient.jar')
compile files('libs/org.apache.http.legacy.jar')
compile project(':seekArc_library')
compile project(':socialauthandroid')
compile project(':SwipeMenuListView')
compile 'com.android.support:design:24.0.0'//or you used compile 'com.android.support:design:23.4.0'

 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM