将 firebase 项目从旧域升级到新的 google firebase 域时出现以下错误。
Failed to resolve: com.google.firebase:firebase-core:9.0.0
我按照 Firebase documentation 中提到的步骤进行操作,在 Add Firebase to your Android Project, topic Available libraries 部分中.
解决此错误的方法有哪些?
最佳答案
2017 年 8 月更新
自版本 11.2.0
起,Firebase 和 Google Play 服务依赖项可通过 Google's Maven Repo 获得.您不再需要使用 Android SDK 管理器来导入这些依赖项。
在你的根 build.gradle
文件中添加 repo:
allprojects {
repositories {
// ...
maven { url "https://maven.google.com" }
}
}
如果您使用 gradle 4.0
或更高版本,您可以将 maven { url "https://maven.google.com"}
替换为 google( )
.
9.0.0
版本的 Firebase 是使用 Google Play 服务 9.0 构建的,现在可以在新包装 com.google.firebase:*
请参阅 Google Play 服务 9.0 的发行说明 https://developers.google.com/android/guides/releases#may_2016_-_v90
新版本的软件包 Google Play Services(rev 30)和 Google Repository(rev 26)刚刚在 SDK 管理器中发布,因此您可能只需要更新.
下载 Google Play 服务和 Google 存储库
来自 Android Studio:
- 点击
工具
>Android
>SDK Manager
。 - 点击进入
SDK 工具
标签。 - 选择并安装
Google Play Services
(rev 30)和Google Repository
(rev 26)。请参见下图。 Sync
和Build
您的项目。
来自 IntelliJ IDEA:
截至 2017 年 4 月,最新版本的 Google Play 服务和存储库如下所示。
- 点击
工具
>Android
>SDK Manager
。 - 在
Packages
面板下,查找Extras
。 - 选择并安装
Google Play Services
(rev 39)和Google Repository
(rev 46)。请参见下图。 执行 gradle 项目同步
和Build
您的项目。
关于android - 无法解决 : com. google.firebase :firebase-core:9. 0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37310188/