java - 构建 APK 时出现错误 :Execution failed for task ':app:transformClassesWithJarMergingForDebug' . >

标签 java android build apk

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: 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.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"
        }
    }
}

清理并重建。

关于java - 构建 APK 时出现错误 :Execution failed for task ':app:transformClassesWithJarMergingForDebug' . >,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48165950/

相关文章:

java - 如何根据实数的小数部分递增计数器

java - flutter 中是否有任何类可以像处理程序一样工作?

android - 如何创建其他类可以查看和编辑的 int?安卓

android - 如何在facebook SDK Android中获取用户的facebook个人资料图片

ios - 是否可以让多个应用程序用完一个 iOS .app 文件?

android - Gradle 构建和部署特定的构建类型

java - 在保留其余部分的同时翻转一个字节中的一位的正确方法是什么?

Java动态添加项目到 ListView

java - 在 Android 中通过 Intent 将附件添加到 Gmail 应用程序

build - 是否可以在 Azure DevOps 上的构建管道期间下载文件?