尝试运行项目时遇到错误
错误:任务':app:transformClassesWithJarMergingForDebug'执行失败。
com.android.build.api.transform.TransformException:java.util.zip.ZipException: 重复条目:com / google / android / gms / common / internal / zzc.class
build.gradle文件:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
packagingOptions
{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
aaptOptions {
cruncherEnabled = false
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':bottom-bar')
compile project(':cropper')
}androidTestCompile('com.android.support.test.espresso:espressocore:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile "junit:junit:${rootProject.ext.junitVersion}"
// Multidex
compile 'com.android.support:multidex:1.0.1'
compile "com.android.support:appcompat- v7:${rootProject.ext.supportLibraryVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibraryVersion}"
// RecyclerView
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibraryVersion}"
// CardView
compile "com.android.support:cardview- v7:${rootProject.ext.supportLibraryVersion}"
compile 'com.google.android.gms:play-services:9.0.0'
// Firebase
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-database:11.0.2'
// Butterknife
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
// Design Compatibility for all resolution
compile 'com.intuit.sdp:sdp-android:1.0.3'
// Retrofit API cals
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.0'
// Picaso Image loading
compile 'com.squareup.picasso:picasso:2.5.0'
// Realm db inplace of SQlite
compile 'io.realm:realm-android:0.82.1'}
如果需要其他信息,请告诉我。 谢谢。
答案 0 :(得分:0)
试试这个
packagingOptions
{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
pickFirst 'META-INF/license.txt'
}
答案 1 :(得分:0)
Remove this line
compile 'com.google.android.gms:play-services:9.0.0' add plugin after dependency block
like this
dependencies {
//your dependencies here
}apply plugin: 'com.google.gms.google-services'
and add this line in application build.gradle **classpath 'com.google.gms:google-services:3.0.0'**
Ex:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
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
}
}