Dav*_*edy 5 android firebase responsys
每次我将应用程序的 Firebase 依赖项更新为 2020 年 2 月 27 日更新之后的任何内容时,我都会在运行应用程序时开始看到此异常:
04-29 18:21:58.170 3314 3541 E Firebase-Installations: Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: Failed to get FIS auth token
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.firebase.iid.zzt.zzb(com.google.firebase:firebase-iid@@20.1.6:54)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.firebase.iid.zzt.zza(com.google.firebase:firebase-iid@@20.1.6:72)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.firebase.iid.zzs.run(Unknown Source:12)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@17.1.1:6)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at java.lang.Thread.run(Thread.java:764)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: Caused by: com.google.firebase.installations.FirebaseInstallationsException
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.firebase.installations.FirebaseInstallations.doNetworkCall(com.google.firebase:firebase-installations@@16.2.2:350)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationInternal$0(com.google.firebase:firebase-installations@@16.2.2:323)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at com.google.firebase.installations.FirebaseInstallations$$Lambda$5.run(Unknown Source:4)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
04-29 18:21:58.177 3314 3543 E FirebaseInstanceId: ... 1 more
Run Code Online (Sandbox Code Playgroud)
我已经阅读了几个相关问题并尝试了以下所有方法:
这是项目的 build.gradle 的相关部分:
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.28.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
}
Run Code Online (Sandbox Code Playgroud)
和应用程序的 build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 23
targetSdkVersion 29
// ...
}
signingConfigs {
release {
// ...
}
}
buildTypes {
debug
release {
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-analytics:17.4.0'
implementation 'com.google.firebase:firebase-config:19.1.4'
implementation 'com.google.firebase:firebase-messaging:20.1.6'
implementation fileTree(dir: 'libs', include: ['PushIOManager-6.44.aar'])
// etc...
}
Run Code Online (Sandbox Code Playgroud)
我省略了包、口味、其他依赖等,但希望这已经足够了。我在 Application 类的 onCreate 方法中确实有这个:
// Initialize Fabric with Crashlytics
Fabric.with(this, new Crashlytics());
// Initialize Firebase
FirebaseApp.initializeApp(this);
Run Code Online (Sandbox Code Playgroud)
我把它们拿出来是因为我相信它们不再需要了。无论如何,这没有什么区别。我已经多次浏览 Firebase 文档,但无法弄清楚我遗漏了什么。
编辑:我最初遗漏的依赖项之一是 Responsys。一旦我从我的应用程序中删除它,我就不再看到错误。我正在等待他们支持团队的回音。
Firebase 安装服务(Firebase Cloud Messaging 使用的新组件)需要有效的 Firebase 组合选项(特别是 API 密钥、项目 ID、应用程序 ID)。您的应用程序似乎一路上获得了无效的组合。
如果您要从 初始化应用程序google-services.json,请从 Firebase 控制台下载该应用程序文件的最新版本,然后将其重新包含在您的项目中。手动验证此文件的内容很容易出错,因此我只需制作当前文件的备份副本并将其替换为您下载的文件。
如果这不能解决问题,请联系 Firebase 支持人员并提供google-services.json其他信息,以获取故障排除方面的个性化帮助。
| 归档时间: |
|
| 查看次数: |
6421 次 |
| 最近记录: |