2017-07-04 74 views
-2

当试图编译我的代码我得到:Android编译APK:重复条目

Error: Execution failed for task ':android:transformClassesWithJarMergingForDebug'.

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

您在[原始文章](https://stackoverflow.com/revisions/44913946/2)中使用了“entry”标记,[已弃用](https://meta.stackoverflow.com/问题/ 349778 /),所以我想我会看看使用它的问题。我在你的问题中注意到了一些事情......在你的根build.gradle的顶部缺少一行,还有一些粗略的[L-sep](https://stackoverflow.com/questions/41555397/)字符android build.gradle。我提到在与您的问题有关的机会中删除它们,例如垃圾文件中的不可见字符或缺失的行。 – HostileFork

+0

我会补充一点,如果你想知道为什么这个问题会被低估,那是因为你说*“看起来错误在build.gradle文件中”*然后你给他们。您不提供任何理由说明您为什么相信这一点(请注意,术语'zzjm'没有出现在您呈现的任何地方),并且您没有提供[最小,完整,可验证示例](https:/ /stackoverflow.com/help/mcve)哪些人可以独立测试和重现错误。这并不是说你的猜测是错误的,但它不是一个猜测游戏......研究导致问题的最小例子。 – HostileFork

回答

0

这似乎是与谷歌的服务问题: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依赖项,您将始终使用最新版本。

+0

有关类似问题,请参阅https://stackoverflow.com/a/47456299/8524。 – Diederik

相关问题