Android-Firebase引用版本冲突解决

原因:
加入implementation 'com.google.firebase:firebase-analytics时,一直提示冲突:
Android-Firebase引用版本冲突解决_第1张图片

解决方案:
运行gradlew :app:dependencies >C:\Users\hgy413\Desktop\fa\a.txt打印依赖,搜索上面的play-services-measurement-base, 结果如下:

+--- project :ads
|    +--- com.facebook.android:audience-network-sdk:5.4.0
|    |    \--- com.google.android.gms:play-services-basement:11.0.4 -> 16.0.1
|    |         \--- com.android.support:support-v4:26.1.0 -> 28.0.0 (*)
|    +--- com.google.android.gms:play-services-ads:17.2.1
|    |    +--- com.android.support:customtabs:26.1.0 -> 27.0.2 (*)
|    |    +--- com.google.android.gms:play-services-ads-base:[17.2.1] -> 17.2.1
|    |    +--- com.google.android.gms:play-services-ads-identifier:16.0.0
|    |    |    \--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    +--- com.google.android.gms:play-services-ads-lite:[17.2.1] -> 17.2.1
|    |    |    +--- com.google.android.gms:play-services-ads-base:[17.2.1] -> 17.2.1
|    |    |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    |    \--- com.google.android.gms:play-services-measurement-sdk-api:16.3.0
|    |    |         +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    |         \--- com.google.android.gms:play-services-measurement-base:[16.3.0] -> 16.3.0
|    |    |              \--- com.google.android.gms:play-services-basement:16.0.1 (*)

多试试,就发现使用 implementation 'com.google.firebase:firebase-analytics:16.3.0', 如下:

\--- com.google.firebase:firebase-analytics:16.3.0
     +--- com.google.android.gms:play-services-basement:16.0.1 (*)
     +--- com.google.android.gms:play-services-measurement-api:[16.3.0] -> 16.3.0
     |    +--- com.google.android.gms:play-services-ads-identifier:16.0.0 (*)
     |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
     |    +--- com.google.android.gms:play-services-measurement-base:[16.3.0] -> 16.3.0 (*)
     |    +--- com.google.android.gms:play-services-stats:16.0.1 (*)
     |    +--- com.google.android.gms:play-services-tasks:16.0.1 (*)
     |    +--- com.google.firebase:firebase-analytics-impl:[16.3.0] -> 16.3.0
     |    |    +--- com.google.android.gms:play-services-ads-identifier:16.0.0 (*)
     |    |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
     |    |    +--- com.google.android.gms:play-services-measurement-base:[16.3.0] -> 16.3.0 (*)

参考:
Firebase引用版本冲突解决:Android dependency ‘com.google.android.gms:play-services-basement’ has different

你可能感兴趣的:(Android)