【问题标题】:Error: Program type already present: com.google.android.gms.internal.measurement.zzdz after adding analytics错误:程序类型已存在:com.google.android.gms.internal.measurement.zzdz 添加分析后
【发布时间】:2019-04-21 03:02:54
【问题描述】:

添加谷歌分析后,我收到此错误,还找不到解决方案...

这是我的毕业作品:

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'

【问题讨论】:

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


    【解决方案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'
    }
    

    这对我有用。

    【讨论】:

      【解决方案2】:

      我认为这是因为您使用了 Firebase 库和适用于 Android 的 Google Analytics Services SDK。 它从文档中说,Add Analytics to Your Android App Firebase SDK 是跟踪 Android 应用程序的推荐方法。您可以使用 Firebase 库中的一项服务。

      Analytics   com.google.firebase:firebase-analytics:16.0.5
      

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-07-25
        • 2019-09-04
        • 2020-10-13
        • 2019-05-22
        • 2020-03-26
        • 2019-05-03
        相关资源
        最近更新 更多