错误:程序类型已存在:添加分析后com.google.android.gms.internal.measurement.zzdz

时间:2018-11-18 16:24:07

标签: android gradle google-analytics google-play-services

添加Google Analytics(分析)后,出现此错误,找不到解决方案...

这是我的礼物:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:support-v4:28.0.0-rc02'
implementation 'com.android.support:design:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'

implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.budiyev.android:circular-progress-bar:1.2.0'
implementation 'com.github.channguyen:adv:1.0.0'
implementation 'com.github.jetradarmobile:android-snowfall:1.2.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.github.Binary-Finery:Bungee:master-SNAPSHOT'
implementation 'jp.wasabeef:recyclerview-animators:2.3.0'
implementation 'com.google.firebase:firebase-ads:17.1.0'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.android.support:support-dynamic-animation:28.0.0'

implementation 'com.google.android.gms:play-services-analytics:16.0.5' //added this and got this error!

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}

应用插件:“ com.google.gms.google-services”

2 个答案:

答案 0 :(得分:1)

build.gradle(模块:app)此代码:

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.6'
}
apply plugin: 'com.google.gms.google-services'`

build.gradle(项目:项目)此代码:

dependencies {
    classpath 'com.google.gms:google-services:4.0.1'
}

这对我有用。

答案 1 :(得分:0)

我认为这是因为您已将Firebase库与Android的Google Analytics Services SDK结合使用了。 Add Analytics to Your Android App从文档中说,Firebase SDK是跟踪Android Apps的推荐方法。您可以使用Firebase库中的一项服务。

ContainerTypeB

您可以查看here其他最新版本的Firebase SDK for Android。

如果您想继续使用Google Analytics Services SDK for Android,则可以按照文档中的指南进行操作。