12 月 8 日,我開始在運行一個已經發布到 Google Play 的 Android 專案(使用 Flutter 框架創建)時遇到問題,并且之前編譯時從未出現過問題。
我得到的錯誤如下:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.google.android.gms:play-services-measurement-base:[18.0.0].
Required by:
project :app > project :firebase_analytics > com.google.firebase:firebase-analytics:18.0.0 > com.google.android.gms:play-services-measurement:18.0.0
project :app > project :firebase_analytics > com.google.firebase:firebase-analytics:18.0.0 > com.google.android.gms:play-services-measurement-api:18.0.0
project :app > project :firebase_analytics > com.google.firebase:firebase-analytics:18.0.0 > com.google.android.gms:play-services-measurement-sdk:18.0.0
project :app > project :firebase_analytics > com.google.firebase:firebase-analytics:18.0.0 > com.google.android.gms:play-services-measurement:18.0.0 > com.google.android.gms:play-services-measurement-impl:18.0.0
project :app > project :firebase_analytics > com.google.firebase:firebase-analytics:18.0.0 > com.google.android.gms:play-services-measurement-api:18.0.0 > com.google.android.gms:play-services-measurement-sdk-api:18.0.0
> Failed to list versions for com.google.android.gms:play-services-measurement-base.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-measurement-base/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-measurement-base/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-measurement-base/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
所以我開始挖掘并發現我最近的變化不是問題。并且似乎 Bintray 下載中心在 12 月 1 日日落(google.bintray.com)
由于我使用的是某些 Firebase 軟體包的舊版本,因此此鏈接似乎已關閉,現在我無法編譯我的應用程式。
顫振醫生輸出:
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel unknown, 2.0.3, on macOS 11.4 20F71 darwin-arm, locale en-GB)
[?] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[?] Xcode - develop for iOS and macOS
[?] Chrome - develop for the web
[?] Android Studio (version 2020.3)
[?] VS Code (version 1.63.1)
[?] Connected device (3 available)
? No issues found!
這是我的build.gradle:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
classpath 'com.android.tools.build:gradle:3.5.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
這是我的 app/build.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.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
throw new GradleException("versionCode not found. Define flutter.versionCode in the local.properties file.")
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
throw new GradleException("versionName not found. Define flutter.versionName in the local.properties file.")
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 30
sourceSets {
main.java.srcDirs = 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.reliqium.reliqium"
minSdkVersion 24
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
if (System.getenv()["CI"]) { // CI=true is exported by Codemagic
storeFile file(System.getenv()["FCI_KEYSTORE_PATH"])
storePassword System.getenv()["FCI_KEYSTORE_PASSWORD"]
keyAlias System.getenv()["FCI_KEY_ALIAS"]
keyPassword System.getenv()["FCI_KEY_PASSWORD"]
} else {
keyAlias System.getenv("RELIQIUM_ANDROID_KEYSTORE_ALIAS")
keyPassword System.getenv("RELIQIUM_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD")
storeFile file(System.getenv("HOME") "/keystores/reliqiumapp.keystore")
storePassword System.getenv("RELIQIUM_ANDROID_KEYSTORE_PASSWORD")
}
}
}
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.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.facebook.android:facebook-core:7.0.1'
implementation 'com.facebook.android:facebook-login:7.0.1'
implementation "com.airbnb.android:lottie:3.5.0"
implementation "com.android.support.constraint:constraint-layout:2.0.4"
}
Flutter Firebase 軟體包的版本如下:
- 云火商店:^0.16.0 1
- firebase_analytics:^7.0.1
- firebase_auth: ^0.20.1
- firebase_core: ^0.7.0
- firebase_crashlytics: ^0.4.0 1
- firebase_dynamic_links: ^0.7.0
- firebase_messaging: ^8.0.0-dev.14
- firebase_remote_config: ^0.6.0
- firebase_storage: ^7.0.0
I know, these are outdated versions of the Firebase packages (For multiple reasons it's not viable to upgrade them to their next versions)
The issue seems to be with the Firebase Analytics package. I have tried to remove it but then I get a similar error for the Firebase Cloud Firestore package which is required for the application.
Please can someone help me with this. I have tried multiple things but nothing seems to solve this issue and I need to compile the app to launch a new version soon!
uj5u.com熱心網友回復:
com.google.android.gms:play-services-measurement-base:[18.0.0]版本的基本問題沒有嚴格指定,gradle 必須找到可能的版本但 google.bintray.com 已關閉 - 沒有可用的版本串列
解決此問題的基本流程
查找版本是什么 - 這個[18.0.0]意味著它有版本范圍 Gradle 宣告版本和范圍
搜索com.google.android.gms:play-services-measurement-base 的版本以查找您可以設定Maven search 的版本。我們有 18.0.0 - 18.0.3 版本
[ 和 ] 符號表示只有一個版本的包含性邊界 - 因此請考慮使用 18.0.0 Gradle 宣告版本和范圍
使用最大可能的版本 18.0.0 限制您的傳遞依賴
編輯您的專案app/build.gradle:
dependencies {
...
constraints {
implementation('com.facebook.android:facebook-login') {
version {
strictly '18.0.0'
}
}
}
}
uj5u.com熱心網友回復:
我通過將 Gradle 版本升級到 v4.1.0 解決了這個問題
android/build.gradle:
dependencies {
...
classpath 'com.android.tools.build:gradle:4.1.0'
...
}
android/gradle/wrapper/gradle-wrapper.properties:
...
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/381950.html
