![](/img/trans.png)
[英]Failed to resolve: com.google.firebase:firebase-core:17.0.0
[英]Failed to resolve: com.google.firebase:firebase-core:11.2.0
同步我的項目時出現多個“無法解決”問題。 它們都是與Firebase和Play服務相關的。 我確保它們都是相同的(11.2.0)。 我還檢查了兩者的最新版本是11.2.0。 此外,所有其他類似問題的答案都涉及在SDK Manager中更新Google Play服務和存儲庫,但是我的已經是最新的了。
知道為什么我無法同步我的項目嗎?
編輯-當前工作解決方案
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.firebase:firebase-plugins:1.0.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
將maven { url "https://maven.google.com" }
到您的根目錄build.gradle
文件中
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
隨着Google Play服務和Firebase 11.2.0版的發布,現在可以通過maven.google.com
獲得Play服務和Firebase依賴項。
您可以在此處找到Google Play服務官方文檔,並在此處找到Firebase文檔。 。
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
如果您使用的是android gradle插件3.x,則還可以使用:
allprojects {
repositories {
jcenter()
google()
}
}
我只是通過添加firebase-core依賴關系來修復了相同的錯誤。
implementation 'com.google.firebase:firebase-core:16.0.1'
隨着16.0.0
版本的發布,我不得不
15.0.0
分析,並將tagmanager設置為16.0.0
27.1.1
16.0.0
-core到16.0.0
針對sdk 27構建
額外更改:
我還必須將分析更新為16.0.0
我猜,Android最近做了一些獨立版本的事情。 可能需要嘗試在Google Play服務和Firebase庫上提升或降低版本
解決此問題的最佳方法是不使用將Firebase鏈接到您的應用程序的手動方法。
我嘗試通過引用此Link添加最新的Firebase回購。
它顯示錯誤“無法解決依賴項firebase 11.2.0”
FireBase建議借助適用於Android Studio 2.2及更高版本的FireBase助手將Firebase添加到您的應用程序。 手動將最新的庫添加到build-gradle(module)會導致上述錯誤。
Firebase助手自動將較低版本10.0.1添加到對gradle-build模塊的依賴關系中,該版本是兼容的並且可以解決。
使用Firebase助手非常簡單,只需2個步驟。 作為參考,您可以在上述同一鏈接上使用“使用Firebase助手”部分。
我的Android Studio 2.3.3確實可以解決此問題。 還要確保您的Google Repository是最新的
從工具-> SDK管理器-> SDK工具安裝谷歌播放服務和谷歌存儲庫並同步您的項目將正常工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.