gpt4 book ai didi

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

转载 作者:IT老高 更新时间:2023-10-28 12:34:28 29 4
gpt4 key购买 nike

我想在我的应用上添加带有 firebase 的通知。我在 YouTube 上关注了一个视频 (https://www.youtube.com/watch?v=xx7hemn3FY4)但是当我在我的 flutter 项目中做同样的事情时出现错误:[[15.0.1,15.0.1]] 的各种其他库正在请求库 com.google.android.gms:play-services-basement ,但解析为 11.8.0。禁用插件并使用 ./gradlew :app:dependencies 检查你的依赖树。

如您在评论中看到的,我尝试了几件事。

项目等级:

 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"
}

}
}
}

应用分级:

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'

但是这些更改都不起作用。你有其他想法吗?

最佳答案

我遇到了类似的问题,在错误消息中它指出

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
}

我通过添加行解决了我的问题

implementation 'com.google.firebase:firebase-core:11.8.0'.  // <<--- Add this

另外,如果这不能解决问题,请添加此行;

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

在同一文件的末尾,如下所示;

...

dependencies {
....
}

....

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

如果它解决了我们的问题,请告诉我。

谢谢!

关于android - 库 com.google.android.gms :play-services-basement is being requested by various other libraries at [[15. 0.1,15.0.1]],但解析为 11.8.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51485608/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com