【问题标题】:Android build apk: duplicate entryAndroid构建apk:重复条目
【发布时间】:2017-12-08 09:32:12
【问题描述】:

当我尝试编译我的代码时,我得到:

错误:任务 ':android:transformClassesWithJarMergingForDebug' 执行失败。

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/internal/zzjm.class

似乎错误在 build.gradle 文件中。这是根 build.gradle:

// Ed's note: apparent missing line here from original post
    dependencies {
       classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
       classpath 'com.android.tools.build:gradle:2.3.2'
       classpath 'com.google.gms:google-services:3.0.0'
    }
}

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
    }
}

project(":core") {
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
    }
}

tasks.eclipse.doLast {
    delete ".project"
}

android build.gradle 包含:

dependencies {
    compile project(':baseGameUtils')
    //compile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/appbrain-applift-sdk-10.51.jar')
    compile 'com.google.android.gms:play-services-ads:9.0.0'
}
apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 您在original post 中使用了“entry”标签,即being deprecated,所以我想我会使用它来查看问题。我注意到你的问题中有几件事......你的根 build.gradle 顶部缺少一行,还有一些粗略的 L-sep 字符在你的 android build.gradle 中。我提到删除它们是因为它与您的问题有关,例如文件中有垃圾不可见字符,或缺少行。
  • 我要补充一点,如果你想知道为什么这个问题会被否决,那是因为你说 “似乎错误在 build.gradle 文件中” 然后你给他们。您没有提供任何理由说明您为什么相信这一点(请注意,术语 zzjm 没有出现在您所提供的任何地方),并且您没有提供有人可以独立测试和重现错误的 Minimal, Complete, Verifiable Example为自己。这并不是说您的猜测是错误的,但这不是猜谜游戏...研究导致问题的最小示例。

标签: android duplicates


【解决方案1】:

这似乎是 google-services:3.0.0 的问题 当您使用 com.google.gms:google-services:3.1.0 时,问题应该得到解决。

我碰巧在 AppBrain 工作,我注意到您对 AppBrain SDK 的 gradle 配置使用了一个相当过时的版本(10.51,而当前版本是 13.22)。如果您按照我们在 https://www.appbrain.com/info/help/sdk/gettingstarted.html 的文档中指定的方式添加 gradle 依赖项,您将始终使用最新版本。

【讨论】:

    猜你喜欢
    • 2018-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-25
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 2018-05-20
    相关资源
    最近更新 更多