下面是我在添加Firebase、gradle中的google服务和应用程序模块中的google-services.json之后遇到的错误。
我的应用程序中有13个模块。我在所有模块中都有7种构建变体。我尝试将google-services.json放在app模块中,并将其放置在app模块中的build variant文件夹中。我也犯了同样的错误。我在一个构建变体中有通知特性。
我从应用程序中删除了gradle和google-services.json中与防火墙相关的代码,它运行得很好。
出于安全原因,我不能分享整个文件。
主要应用程序模块级:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.github.hotchemi:permissionsdispatcher:2.0.7'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.7'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:multidex:1.0.1'
}
在应用分级中:
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
}
:app:transformClassesWithJarMergingForSmePreDebug失败:生成失败,但有异常。 *出了什么问题:任务':app:transformClassesWithJarMergingForSmePreDebug'.>执行失败 com.android.build.api.transform.TransformException: java.util.zip.ZipException:复制条目:com/google/android/gms/ duplicate /api/zza.class
我在StackOverflow中为这个问题提供了许多链接。没人能解决我的问题。如有任何建议请见谅。
编辑的推送通知模块级:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
//compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
//compile ('com.google.firebase:firebase-messaging:9.8.0') {
//exclude group: 'com.google.android.gms'
//}
}
apply plugin: 'com.google.gms.google-services'
发布于 2016-11-11 10:44:33
此问题可能是因为您有重复的依赖关系。一个是最新版本,另一个是旧版本。
你能做的就是
这可能是一个快速的解决办法。但这不是好事!
最好的解决方案应该是更新您的第三方库,他们的最新版本可能已经更新了他们的google服务库。
https://stackoverflow.com/questions/40492785
复制相似问题