![](/img/trans.png)
[英]Could not resolve com.google.firebase:firebase-analytics:16.5.0
[英]Failed to resolve: com.google.firebase:firebase-analytics:19.0.0
我正在嘗試添加 Firebase Analytics,並且在嘗試同步 Gradle 項目時不斷收到以下錯誤:
ERROR: Failed to resolve: com.google.firebase:firebase-analytics:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.android.gms:play-services-analytics:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.android.gms:play-services-location:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.android.gms:play-services-base:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.android.gms:play-services-cast-framework:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.android.gms:play-services-basement:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.android.gms:play-services-tasks:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.firebase:firebase-measurement-connector:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.android.gms:play-services-stats:19.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.firebase:firebase-iid-interop:19.0.0
Show in Project Structure dialog
Affected Modules: app
這是我正在使用的實現:
implementation 'com.google.firebase:firebase-analytics:17.2.1'
和
classpath 'com.google.gms:google-services:4.3.3'
我已經閱讀了各種帖子,但似乎沒有解決這個問題。
出於某種原因,當我明確告訴它使用版本17.2.1時,我看到它正在嘗試解決版本19.0.0 。
這是 build.gradle 的一個片段:
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
useLibrary 'org.apache.http.legacy'
flavorDimensions "default"
lintOptions {
checkReleaseBuilds false
}
}
repositories {
google()
jcenter()
}
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.onesignal:OneSignal:3.11.4'
implementation 'pl.droidsonroids:casty:1.0.8'
implementation 'androidx.mediarouter:mediarouter:1.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.devbrackets.android:exomedia:4.3.0'
}
和項目 build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
configurations.all {
resolutionStrategy.force "com.google.android.gms:play-services-cast:12.0.1"
}
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& details.requested.name.contains('play-services-cast')) {
details.useVersion "12.0.1"
}
}
}
}
關於什么可能導致這種沖突的任何想法?
試試這個實現 'com.google.firebase:firebase-analytics:17.2.2'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.