【问题标题】:Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > when building APK错误:任务“:app:transformClassesWithJarMergingForDebug”执行失败。 > 构建 APK 时
【发布时间】:2018-06-18 08:32:33
【问题描述】:

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android/support/v7/util/AsyncListUtil.class

我在尝试构建 apk 时收到此错误。应用编译成功,Apk 未构建

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:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.google.code.gson:gson:2.4'
compile 'org.apache.karaf.http:http:3.0.5'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.google.android.gms:play-services:11.0.4'

compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:customtabs:26.0.1'
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile('com.facebook.android:facebook-android-sdk:4.23.0')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = 
true }
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile project(':adcolony-sdk-3.1.2')
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
}

【问题讨论】:

  • 使用 compile 'com.google.code.gson:gson:2.8.2' 。对于测试用例删除compile 'com.android.support:support-v4:26.0.1'
  • 这样不行,请帮忙

标签: java android build apk


【解决方案1】:

尝试在compile 'com.android.support:support-v4:26.0.1' 行将 v4 更改为 v7,如下面的代码

     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:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:26.0.1'
    compile 'com.android.support:design:26.0.1'
    compile 'uk.co.chrisjenx:calligraphy:2.1.0'
    compile 'com.google.code.gson:gson:2.4'
    compile 'org.apache.karaf.http:http:3.0.5'
    compile 'com.android.support:support-v7:26.0.1' //change here
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.google.android.gms:play-services:11.0.4'

    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.android.support:customtabs:26.0.1'
    compile 'com.firebaseui:firebase-ui-auth:2.3.0'
    compile('com.facebook.android:facebook-android-sdk:4.23.0')
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }
    compile 'com.google.android.gms:play-services-ads:11.0.4'
    compile 'com.google.android.gms:play-services-location:11.0.4'
    compile project(':adcolony-sdk-3.1.2')
    compile 'com.squareup.picasso:picasso:2.5.2'
    testCompile 'junit:junit:4.12'
}

更新

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

清理并重建。

【讨论】:

猜你喜欢
  • 2016-01-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多