【问题标题】:The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1[[15.0.1,15.0.1]] 的各种其他库正在请求库 com.google.android.gms:play-services-basement,但解析为 16.0.1
【发布时间】:2018-10-09 14:19:19
【问题描述】:

现在我已将所有依赖项更新到最新版本,然后我遇到了这个问题。

库 com.google.android.gms:play-services-basement 正在 [[15.0.1,15.0.1]] 的各种其他图书馆要求,但 解析为 16.0.1。禁用插件并检查您的依赖项 使用 ./gradlew :app:dependencies 的树。

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

implementation 'com.google.firebase:firebase-messaging:17.3.3'
implementation "com.google.android.gms:play-services-maps:16.0.1"
implementation "com.google.android.gms:play-services-location:16.0.1"

请帮我解决这个问题... 提前致谢...

【问题讨论】:

  • 您使用的是哪个 Android Studio 版本和哪个 gradle 版本?
  • 3.2 现在正在使用@Barns
  • 你试过play-services-maps:15.0.1play-services-location:15.0.1firebase-messaging:17.3.2吗?现在,这对我有用。
  • 是的,同样的问题也发生了
  • 我也在使用classpath 'com.google.gms:google-services:4.1.0'firebase-core:16.0.3

标签: android android-studio gradle android-gradle-plugin build.gradle


【解决方案1】:

此冲突是由于使用较旧的库而发生的,解决方案是尽可能使用最新的库。 就我而言,我使用的是 firebase 版本 16.0.0 ,当前最新版本是 16.0.4 (07-02-2019)

我在用这个

 implementation 'com.google.firebase:firebase-core:16.0.0'

而不是这个

 implementation 'com.google.firebase:firebase-core:16.0.4'

【讨论】:

    【解决方案2】:

    Android(项目级 build.gradle)

    buildscript {
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
            classpath 'com.google.gms:google-services:4.0.0'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
        project.evaluationDependsOn(':app')
    }
    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "26.1.0"
                }
            }
        }
    }
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    Android(应用级 build.gradle)

    apply plugin: 'com.android.application'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    
    android {
        compileSdkVersion 28
    
        lintOptions {
            disable 'InvalidPackage'
        }
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.chatflutterapp.fullterchat"
            minSdkVersion 16
            targetSdkVersion 28
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
    
        buildTypes {
            release {
                // TODO: Add your own signing config for the release build.
                // Signing with the debug keys for now, so `flutter run --release` works.
                signingConfig signingConfigs.debug
            }
        }
    }
    
    flutter {
        source '../..'
    }
    
    dependencies {
        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'
        compile 'com.google.firebase:firebase-core:16.0.4'
    }
    apply plugin: 'com.google.gms.google-services'
    com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
    

    【讨论】:

      【解决方案3】:

      在我的情况下,我遇到了同样的问题,按照以下步骤使其运行:

      1) 注释所有 firebase 依赖项

      2) 注释类中的所有 firebase 用法

      3) 清理并重建项目

      4) 取消注释所有注释行

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-06-19
        • 2018-12-31
        • 2019-04-01
        • 1970-01-01
        • 2019-06-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多