android - 如何解决依赖冲突?

标签 android android-gradle-plugin

冲突在哪里,如何解决,以及日后寻找冲突的根源?

compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    minSdkVersion 17
    targetSdkVersion 27
}


implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'


implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'

implementation 'com.google.maps.android:android-maps-utils:0.4.3'

implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-crash:16.0.0'


apply plugin: 'com.google.gms.google-services'

最佳答案

您的依赖项之一是拥有不同版本的 com.google.android.gms

我检查了 github page 中的 com.google.maps.android:android-maps-utils:0.4.3 。我发现它使用的是非常旧版本的 map ,请参见上面的页面。

dependencies {
    compile 'com.google.android.gms:play-services-maps:11.0.4'
}

作为解决方案,您可以

  1. 按照与 ma​​ps-utils 相同的方式降级您的播放服务依赖项版本
  2. 或者您可以通过从 github 页面下载来升级此依赖项 gms 版本,并将其作为模块添加到您的项目中。

请记住,如果您在应用中使用最新版本的 gms 依赖项,请在项目级别 build.gradle 中使用最新的 google-services。喜欢

classpath 'com.google.gms:google-services:3.3.0'

编辑 使用此配置降级您的 gms 和 firebase 版本。

def GMS_VERSION = "11.0.4"
def FCM_VERSION = "11.0.4"

dependencies {
// ...
    implementation "com.google.android.gms:play-services-analytics:$GMS_VERSION"
    implementation "com.google.android.gms:play-services-location:$GMS_VERSION"
    implementation "com.google.android.gms:play-services-maps:$GMS_VERSION"
    implementation "com.google.android.gms:play-services-places:$GMS_VERSION"

    implementation 'com.google.maps.android:android-maps-utils:0.4.3'

    implementation "com.google.firebase:firebase-messaging:$FCM_VERSION"
    implementation "com.google.firebase:firebase-crash:$FCM_VERSION"
}

关于android - 如何解决依赖冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50668581/

相关文章:

android - 无法在 Android Studio 中通过 ozodrukh 添加 CircularReveal 库

android - 依赖项、模块的问题。如何正确引用该库?

android - 库 com.google.android.gms :play-services-basement is being requested by various other libraries at [[15. 0.1,15.0.1]],但解析为 16.0.1

android - 获取设备 token ?

java - 如何从不同网站收集新闻

Android在状态栏后面绘制但不在导航栏后面

android - 找不到满足版本限制的 'androidx.arch.core:core-common' 版本

android - 如何检测Android手机联系人应用程序是否支持结构化邮政地址?

android - 如何强制画廊以横向打开?

Android Studio gradle.properties 文件在哪里?