在模块jetified-firebase-analytics-impl-1中找到的重复类com.google.android.gms.measurement.AppMeasurement

时间:2019-12-20 20:29:44

标签: java android-studio

我试图将我的Android应用程序连接到Google Calander API,但我被卡住了。 我在我的应用程序中有很多关于重复项的错误,不知道为什么。 我更新了所有模块。 我的错误:

Duplicate class com.google.android.gms.measurement.AppMeasurement found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-impl-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$ConditionalUserProperty found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-impl-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$Event found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-impl-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$EventInterceptor found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-impl-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$OnEventListener found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-impl-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$Param found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-impl-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$UserProperty found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-impl-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.2.1)
Duplicate class com.google.firebase.analytics.FirebaseAnalytics found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-api-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-api:17.2.1)
Duplicate class com.google.firebase.analytics.FirebaseAnalytics$Event found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-api-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-api:17.2.1)
Duplicate class com.google.firebase.analytics.FirebaseAnalytics$Param found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-api-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-api:17.2.1)
Duplicate class com.google.firebase.analytics.FirebaseAnalytics$UserProperty found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and play-services-measurement-api-17.2.1-runtime.jar (com.google.android.gms:play-services-measurement-api:17.2.1)

我的礼物

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-database:19.2.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    implementation 'com.google.firebase:firebase-analytics:17.2.1'
    implementation "com.google.firebase:firebase-auth:19.2.0"
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.apis:google-api-services-calendar:v3-rev401-1.25.0'
    implementation 'com.google.api-client:google-api-client:1.30.7'
    implementation 'com.google.api-client:google-api-client-android:1.30.7'
    implementation 'com.google.api-client:google-api-client-gson:1.19.1'
}

1 个答案:

答案 0 :(得分:1)

删除实现'com.google.android.gms:play-services:12.0.1'的依赖关系,而改用单个依赖项。com.google.android.gms:play-services:12.0.1内部包含很多依赖项。使用播放服务可能会导致dex问题和繁重的应用程序。仅选择您真正依赖的对象。 source