android – 使用firebase-analytics时复制jar条目:16.0.5
作者:互联网
官方修正了广告17.1.1(developers.google.com/android/guides/releases)
将firebase-analytics的版本从16.0.4更新为16.0.5
该项目无法构建发布aab / apk,错误消息Duplicate jar entry [com / google / android / gms / internal / measurement / zzdz.class]
Android Studio 3.2.1
app的build.gradle
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-analytics:16.0.5'
implementation 'com.google.firebase:firebase-ads:17.1.0'
implementation 'com.google.firebase:firebase-perf:16.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.6'
项目build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
classpath 'com.google.firebase:firebase-plugins:1.1.5'
classpath 'io.fabric.tools:gradle:1.26.1'
}
错误
Caused by: java.io.IOException: Can't write [MASKED\app\build\intermediates\transforms\proguard\release\0.jar] (Can't read [MASKED\app\build\intermediates\transforms\FirebasePerformancePlugin\release\21(;;;;;;;**.class)] (Can't read [com] (Can't read [google] (Can't read [android] (Can't read [gms] (Can't read [internal] (Can't read [measurement] (Can't read [zzdz.class] (Duplicate jar entry [com/google/android/gms/internal/measurement/zzdz.class]))))))))) at proguard.OutputWriter.writeOutput(OutputWriter.java:202) at proguard.OutputWriter.execute(OutputWriter.java:89) at proguard.ProGuard.writeOutput(ProGuard.java:515) at proguard.ProGuard.execute(ProGuard.java:210) at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:64) at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:262) at com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:65) at com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:176) at com.android.builder.tasks.Job.runTask(Job.java:47) at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41) at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:282) ... 1 more
在发布修复程序之前的任何解决方法?
解决方法:
使用gradlew:app:dependencies并发现一些依赖项没有使用最新版本.
手动添加以下依赖项以覆盖加载的版本可以解决问题.
implementation 'com.google.android.gms:play-services-measurement-sdk-api:16.0.3'
implementation 'com.google.android.gms:play-services-basement:16.1.0'
标签:android,firebase,firebase-analytics 来源: https://codeday.me/bug/20190701/1346076.html