gpt4 book ai didi

android - Gradle 无法解析未请求的版本

转载 作者:搜寻专家 更新时间:2023-11-01 09:22:28 26 4
gpt4 key购买 nike

我正在更新我的 Android 项目中的 Firebase 和 Google Play 服务。这就是我更新依赖项的方式:

//Play Services
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-measurement-base:16.0.5'
implementation 'com.google.maps.android:android-maps-utils:0.5'

//Firebase
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.0'
implementation 'com.onesignal:OneSignal:3.10.3'

当我构建我的项目时,它失败并出现以下错误:

Failed to resolve: com.google.android.gms:play-services-maps:17.3.4
Failed to resolve: com.google.android.gms:play-services-gcm:17.3.4
Failed to resolve: com.google.android.gms:play-services-location:17.3.4
Failed to resolve: com.google.android.gms:play-services-measurement-base:17.3.4
Failed to resolve: com.google.firebase:firebase-core:17.3.4
Failed to resolve: com.google.firebase:firebase-config:17.3.4
Failed to resolve: com.google.android.gms:play-services-basement:17.3.4
Failed to resolve: com.google.android.gms:play-services-tasks:17.3.4
Failed to resolve: com.google.firebase:firebase-common:17.3.4
Failed to resolve: com.google.firebase:firebase-iid:17.3.4
Failed to resolve: com.google.firebase:firebase-measurement-connector:17.3.4
Failed to resolve: com.google.android.gms:play-services-base:17.3.4

出于某种原因,所有库都需要版本 17.3.4。如何让它发挥作用?

根 gradle 文件如下所示:

buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
}

allprojects {
repositories {
maven { url 'https://jitpack.io' }
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

最佳答案

我之前遇到过 OneSignal 和依赖项的问题(例如 dependency conflict with itself )。我建议回滚到早期版本的库,看看它是否是最近的问题。

您是否也可以尝试将 mavenCentral() 添加为存储库,因为它(至少以前)托管在那里。

关于android - Gradle 无法解析未请求的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53635853/

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