各种其他库都在[[15.0.1,15.0.1]]请求库com.google.android.gms:play-services-basement库,但解析为16.0.1。

时间:2018-10-09 14:19:20

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

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

  

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"

请帮助我解决此问题... 在此先感谢...

3 个答案:

答案 0 :(得分:3)

由于使用较旧的库而发生此冲突,解决方案是尽可能使用最新的库。 就我而言,我正在使用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'

答案 1 :(得分:1)

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

答案 2 :(得分:0)

就我而言,我遇到了同样的问题,请按照以下步骤操作:

  

1)注释所有Firebase依赖项

     

2)注释所有来自类的Firebase使用情况

     

3)清理并重建项目

     

4)取消注释所有评论行