【发布时间】:2016-10-09 08:47:20
【问题描述】:
本周早些时候我遇到了一个问题。当我尝试进行 Android 发布构建时,它似乎显示以下错误--
错误:任务 ':app:transformClassesWithJarMergingForRelease' 执行失败。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/internal/zzjm.class
我想知道我是如何得到这个错误的以及如何修复它。似乎问题出在 build.gradle 文件中。他们在这里--
应用级别 -
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.unknown.app"
minSdkVersion 13
targetSdkVersion 23
versionCode 20
versionName "2.34"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':BaseGameUtils')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.firebase:firebase-ads:9.0.2'
compile ('com.google.android.gms:play-services:9.0.2'){
exclude group: 'com.google.android.gms.play-services-ads'
}
compile project(path: ':BaseGameUtils')
}
apply plugin: 'com.google.gms.google-services'
这里是顶层——
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
感谢所有帮助。我有这个问题有一段时间了。我在任何其他堆栈溢出问题中都找不到答案。再次感谢。
【问题讨论】:
-
尝试清理项目,或者从项目中删除 build 和 bin 文件夹
-
好的。我再看看吧。谢谢。
-
感谢您的帮助,但没有成功。
-
只是抛出一个想法,虽然我什么都找不到,难道是因为你编译了两次BaseGameUtils项目?如果没有,请尝试暂时删除 firebase 和 play-services 看看是什么原因,一次只添加一个。
-
好的。感谢您的建议。
标签: java android android-studio build.gradle