android - 在构建 gradle 中将类路径“com.google.gms:google-services:4.3.8”更改为 4.3.9 时,FirebaseApp 未初始化错误
问题描述
我将我的 Android 项目更新为 7.0.2,这改变了
classpath 'com.google.gms:google-services:4.3.8' to
classpath 'com.google.gms:google-services:4.3.9'.
更新后,我开始收到一个错误,即 FirebaseApp 未初始化或构建 Gradle 不包括 gms: google services。
我试图添加
FirebaseApp.initializeApp(mycontext);
方法也在触发错误的我的 Firebase 令牌异步任务中,但这无济于事。
有人可以建议如何解决吗?
解决方案
在您的应用级 Gradle 文件中,在文件底部添加“应用插件”行以启用 Gradle 插件:
apply plugin: 'com.android.application'
dependencies {
// ...
implementation 'com.google.firebase:firebase-bom'
// If getting a "Could not find" error? Make sure you have the latest Google
// Repository in the Android SDK manager
}
//ADD THIS LINE AT BOTTOM
apply plugin: 'com.google.gms.google-services'
或者你可以像这样添加插件:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
现在,同步两个 gradle 文件
推荐阅读
- android - 我的 android studio 没有在 windows 10 上打开
- flutter - HATEOAS API Flutter 客户端推荐
- c++ - 如何在虚幻引擎中使用第三方库 Eigen?
- javascript - 在“片段”中键入段落时出错
- javascript - Bootstrap 5:在 Button 中对齐图标和文本
- python - Python Pandas 删除具有数字的行(不是浮点数也不是整数,而是像 1.2.3)
- python - 移植到 Python 3.7,poster3.encode.multipart_encode,TypeError: memoryview: a bytes-like object is required, not 'str'
- angular - 在 Angular 中使用 IconFinderCore 进行图标化返回“not_found”错误
- r - 如何返回列的行值,使得它们在另一列中的对应值是最小的 n 值,在 R
- amazon-web-services - AWS DeviceFarm 忽略 TestNG 注释