Every time I update my app's Firebase dependencies to anything more recent than the Feb. 27 2020 update, I start seeing this exception when I run my app:
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
I've read several related questions and tried all of the following:
- I verified my API key has no restrictions (SHA-1 or API restrictions) in Google Cloud Platform.
- I verified the google-services.json provided by Firebase matches the one included in my project.
- I verified the API key, project ID, and application ID in the google-services.json file are correct.
- I verified all the devices I'm testing on (a mix of emulators with different API versions and physical devices) have the Play Store and Play Services and are updated to the latest versions.
- I verified the APK is signed with the correct key - debug key for debug builds and my app signing key for release builds.
- I verified Firebase is set up correctly in my app.
Here's the relevant parts of the project's 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()
}
}
}
And the app's 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...
}
I left out the bundles, flavors, other dependencies, etc. but hopefully this is enough. I did have this in my Application class's onCreate method:
// Initialize Fabric with Crashlytics
Fabric.with(this, new Crashlytics());
// Initialize Firebase
FirebaseApp.initializeApp(this);
I took those out because I believe they're no longer needed. Regardless, it makes no difference. I've gone over the Firebase documentation several times and can't figure out what I'm missing.
Edit: one of the dependencies I originally left out was Responsys. As soon as I removed it from my app, I stopped seeing the errors. I'm waiting to hear back from their support team.