com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/androi
Posted
技术标签:
【中文标题】com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/internal/zzbn.class【英文标题】:com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzbn.class 【发布时间】:2016-06-09 06:23:21 【问题描述】:在将 firebase sdk 添加到 gradle 后面临以下问题。
错误:任务 ':app:transformClassesWithJarMergingForDebug' 执行失败。
请帮忙!!
This is the APP gradle file
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.fernandocejas.frodo'
apply plugin: 'realm-android'
apply plugin: 'com.neenbedankt.android-apt'
android
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig
applicationId "com.bt.bms"
minSdkVersion 16
targetSdkVersion 23
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 6
versionName "0.0.11"
multiDexEnabled true
// Following line of code added to provide support for blurring image using renderscript
renderscriptTargetApi 16
renderscriptSupportModeEnabled true
signingConfigs
bms_debug_config
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('bms_new_app_debug.keystore')
storePassword 'android'
packagingOptions
exclude 'APK LICENSE.txt'
exclude 'LICENSE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
buildTypes
// debug
// applicationIdSuffix ".debug"
// minifyEnabled false
// debuggable true
//
release
minifyEnabled false
proguardFiles 'proguard.cfg'
debug
signingConfig signingConfigs.bms_debug_config
compileOptions
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
lintOptions
checkReleaseBuilds true
defaultPublishConfig "debug"
repositories
jcenter()
maven url = "https://oss.sonatype.org/content/repositories/snapshots/"
flatDir
dirs 'libs'
dexOptions
incremental true
javaMaxHeapSize "8g"
String getJavaHome(String version)
def stdout = new ByteArrayOutputStream()
exec
commandLine "/usr/libexec/java_home", "-v", version
standardOutput = stdout;
return stdout.toString().trim()
retrolambda
//jvmArgs '-noverify'
jdk System.getenv('JAVA8_HOME') ?: getJavaHome("1.8")
oldJdk System.getenv('JAVA7_HOME') ?: getJavaHome("1.7")
dependencies
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':common')
compile project(':domain')
compile project(':api')
apt project(':compiler')
// Times Square Library for calendar
compile project(':timessquare')
// App Modules
compile(name: 'app-models', ext: 'aar')
compile(name: 'app-network', ext: 'aar')
compile(name: 'app-error', ext: 'aar')
// Android support libraries
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:percent:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:palette-v7:23.4.0'
//Play Services Location and Map
compile 'com.google.android.gms:play-services-location:9.0.2'
// For G+ login
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.google.android.gms:play-services-plus:9.0.2'
// Facebook
compile ('com.facebook.android:facebook-android-sdk:4.7.0')
exclude group: 'com.google.android.gms'
// For Clever Tap
compile 'com.clevertap.android:clevertap-android-sdk:2.0.5'
// Espresso Related Dependencies
compile 'com.android.support.test.espresso:espresso-idling-resource:2.2'
testCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2')
// Necessary if your app targets Marshmallow (since Espresso hasn't moved to Marshmallow yet)
exclude group: 'com.android.support', module: 'support-annotations'
androidTestCompile('com.android.support.test:runner:0.3')
// Necessary if your app targets Marshmallow (since the test runner hasn't moved to Marshmallow yet)
exclude group: 'com.android.support', module: 'support-annotations'
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2')
// Necessary to avoid version conflicts
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'recyclerview-v7'
androidTestCompile('com.android.support.test.espresso:espresso-intents:2.2')
exclude group: 'com.android.support', module: 'support-annotations'
// Retrofit
compile 'com.squareup.retrofit:retrofit:2.0.0-beta4'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
// Reactive x
compile 'io.reactivex:rxandroid:1.0.1'
compile 'javax.inject:javax.inject:1'
// Picasso
compile 'com.squareup.picasso:picasso:2.4.0'
// Butterknife
compile 'com.jakewharton:butterknife:7.0.1'
// Dagger 2 dependencies
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
// Crashlytics
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar')
transitive = true;
// Anotation
compile 'javax.annotation:javax.annotation-api:1.2'
// Other
compile 'com.alexvasilkov:foldable-layout:1.0.1'
compile 'com.ms-square:expandableTextView:0.1.4'
compile 'com.mikhaellopez:circularimageview:2.0.1'
compile 'com.makeramen:roundedimageview:2.2.1'
// For Multidex
compile 'com.android.support:multidex:1.0.1'
//For Bottom Sheet
compile 'com.flipboard:bottomsheet-core:1.5.0'
compile 'com.flipboard:bottomsheet-commons:1.5.0'
// For Juspay
compile('in.juspay:godel:0.6.7')
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
// For mockito
compile 'org.mockito:mockito-all:2.0.2-beta'
// Parceler
compile 'org.parceler:parceler-api:1.0.4'
apt 'org.parceler:parceler:1.0.4'
// Expandable Recycler View
compile 'com.github.grennis:ExpandableRecyclerView:0.9.3'
// For JW Player
compile project(':jwplayer-android-sdk-2.1.1+142')
compile 'com.google.android.libraries.cast.companionlibrary:ccl:2.8.3'
//Sectioned RecyclerView
compile 'eu.davidea:flexible-adapter:5.0.0-b6'
compile 'jp.wasabeef:recyclerview-animators:2.2.3'
debugCompile 'com.github.promeg:xlog-compiler:2.1.1' // ~6kB
debugCompile 'com.github.promeg:xlog-android:2.1.1' // ~150kB
releaseCompile 'com.github.promeg:xlog-android-idle:2.1.1' // ~5kB
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
// For Firebase
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-config:9.0.2'
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
发布你的 gradle 文件依赖项 分享你的 gradle 文件... 想出了问题。 clevertap 库在内部使用 8.4.0 google play 服务。从clevertap中排除gcm工作 【参考方案1】:只需执行命令 - ./gradlew :app:dependencies
,然后查看您在内部使用的库是否使用任何其他版本的 google play 服务。如果是,则删除或更新这些库。
【讨论】:
真的很省事,用这个命令,基本上可以找出依赖树,然后只需要修复编译库版本。 这确实有效,非常感谢。我在这上面浪费了很多时间。最后,一个解决方案:)以上是关于com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/androi的主要内容,如果未能解决你的问题,请参考以下文章