各种其他库都在[[15.0.1,15.0.1]]请求库com.google.android.gms:play-services-basement库,但解析为11.8.0 [英] 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 11.8.0
问题描述
我想在我的应用中添加带有Firebase的通知.我在YouTube上观看了一个视频( https://www.youtube.com/watch?v=xx7hemn3FY4 )但是当我在flutter项目中做同样的事情时,我遇到了一个错误:com.google.android.gms:play-services-basement库正在由[[15.0.1,15.0.1]]的其他各种库请求,但解析为11.8.0.禁用插件,并使用./gradlew:app:dependencies检查您的依赖关系树.
I would like to add notification with firebase on my app. I followed a video on YouTube (https://www.youtube.com/watch?v=xx7hemn3FY4) But I have an error when I do the same thing in my flutter project : 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 11.8.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
正如您在评论中看到的,我尝试了几件事.
I tried several things as you can see in comment.
项目gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.1'
//classpath 'com.google.gms:google-services:4.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
/*
maven {
url "https://maven.google.com" // Google's Maven repository
}
*/
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "27.1.0"
}
}
}
}
App Gradle:
App Gradle :
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.weatherapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
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.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//Implementation 'com.google.android.gms:play-services-basement:15.0.1'
//Implementation 'com.google.firebase:firebase-core:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
但这些更改均无效.您还有其他想法吗?
But none of these changes works. Do you have an other idea ?
推荐答案
我遇到了类似的问题,在错误消息中指出
I faced the similar issue, where in the error message it states that
其他[= [15.0.1,15.0.1]]图书馆正在请求库com.google.android.gms:play-services-basement,但解析为11.8.0 .禁用插件,并使用./gradlew:app:dependencies检查您的依赖关系树.
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 11.8.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
已解决已解决为11.8.0
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//Implementation 'com.google.android.gms:play-services-basement:15.0.1'
//Implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-core:11.8.0'. // <<--- Add this
}
我通过添加一行来解决我的问题
I solved my isssue by adding the line
implementation 'com.google.firebase:firebase-core:11.8.0'. // <<--- Add this
如果这不能解决问题,请添加此行;
Also if this doesn't fix the issue please add this line;
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
在同一文件的末尾,如下所示;
at the end of the same file like below;
...
dependencies {
....
}
....
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
让我知道它是否解决了我们的问题.
Let me know if it solved our issue.
谢谢!
这篇关于各种其他库都在[[15.0.1,15.0.1]]请求库com.google.android.gms:play-services-basement库,但解析为11.8.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!