有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java获取错误:库com。谷歌。安卓gms:playservicesbasement正被其他多家图书馆请求访问[[11.0.4,11.0.4]]

当我有这些依赖项时,我所有的代码都工作得很好


   //noinspection GradleCompatible
   implementation 'com.google.安卓.gms:play-services-places:11.0.4'
   implementation 'com.google.安卓.gms:play-services-location:11.0.4'
   implementation 'com.google.安卓.gms:play-services-maps:11.0.4'
   implementation 'com.google.maps.安卓:安卓-maps-utils:0.5+'
   implementation 'com.google.firebase:firebase-auth:11.0.4'
   implementation 'com.google.firebase:firebase-core:11.0.4'
   implementation 'com.google.firebase:firebase-messaging:11.0.4'
   implementation 'com.google.firebase:firebase-storage:11.0.4'
   implementation 'com.google.firebase:firebase-database:11.0.4' } 

但当我加上

 implementation 'com.google.安卓.gms:play-services-ads-identifier:15.0.1'

它向我展示了一个错误:-

错误:库com。谷歌。安卓gms:play services地下室由[11.0.4,11.0.4]]上的其他图书馆提出申请,但最终决定为15.0.1。禁用插件并使用检查依赖关系树/gradlew:应用程序:依赖项

我已经尝试过更新我的gms库,但当我这么做的时候,我需要对代码进行一些更改,以满足新的发布要求。我正在寻找解决这个问题的快速方法

我使用的当前版本如下所述:-

classpath 'com.安卓.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.2'

共 (1) 个答案

  1. # 1 楼答案

    使用以下命令

     implementation 'com.google.android.gms:play-services-places:16.0.0'
     implementation 'com.google.android.gms:play-services-location:16.0.0'
     implementation 'com.google.android.gms:play-services-maps:16.1.0'
     implementation 'com.google.maps.android:android-maps-utils:0.5+'
     implementation 'com.google.firebase:firebase-auth:16.2.0'
     implementation 'com.google.firebase:firebase-core:16.0.8'
     implementation 'com.google.firebase:firebase-messaging:17.5.0'
     implementation 'com.google.firebase:firebase-storage:16.1.0'
     implementation 'com.google.firebase:firebase-database:16.1.0'
    

    而不是这个

    implementation 'com.google.android.gms:play-services-places:11.0.4'
    implementation 'com.google.android.gms:play-services-location:11.0.4'
    implementation 'com.google.android.gms:play-services-maps:11.0.4'
    implementation 'com.google.maps.android:android-maps-utils:0.5+'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    implementation 'com.google.firebase:firebase-core:11.0.4'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    implementation 'com.google.firebase:firebase-database:11.0.4'