最新版本上的FirebaseInstallationsException [英] FirebaseInstallationsException on latest version

查看:368
本文介绍了最新版本上的FirebaseInstallationsException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次将应用程序的Firebase依赖关系更新到2020年2月27日更新之外的任何最新内容时,我都会在运行应用程序时看到此异常:

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:

  1. 我已验证我的API密钥在Google Cloud Platform中没有任何限制(SHA-1或API限制).
  2. 我已验证Firebase提供的google-services.json与我项目中包含的google-services.json匹配.
  3. 我已验证google-services.json文件中的API密钥,项目ID和应用程序ID是否正确.
  4. 我已验证我正在测试的所有设备(具有不同API版本和物理设备的仿真器混合使用)是否具有Play商店和Play服务,并且已更新为最新版本.
  5. 我已验证APK是否使用正确的密钥签名-用于调试版本的调试密钥和用于发布版本的应用签名密钥.
  6. 我已验证Firebase是否已在我的应用中正确设置.

这是项目build.gradle的相关部分:

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()
        }
    }
}

应用程序的build.gradle:

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...
}

我省略了捆绑包,样式,其他依赖项等,但希望这足够了.我在我的Application类的onCreate方法中确实有这个:

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);

我把这些带出去了,因为我相信不再需要它们了.无论如何,这没有什么区别.我已经多次浏览了Firebase文档,无法弄清我所缺少的内容.

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.

我最初遗漏的依赖项之一是Responsys.从应用程序中删除它后,我就停止看到错误.我正在等待他们的支持团队的回音.

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.

推荐答案

Firebase安装服务(Firebase Cloud Messaging使用的新组件)需要有效的Firebase组合选项(特别是API密钥,项目ID,应用程序ID).您的应用在此过程中似乎获得了无效的组合.

Firebase installation services (a new component used by Firebase Cloud Messaging) requires a valid Firebase combination options (specifically API key, Project ID, Application ID). Your app seems to have gotten an invalid combination along the way.

如果要从google-services.json初始化应用程序,请从Firebase控制台下载该文件的最新版本,然后将其重新包含在项目中.手动验证此文件的内容容易出错,因此,我只需要备份当前文件,然后将其替换为您下载的文件即可.

If you're initializing the app from a google-services.json, download the latest version of that file for the app from the Firebase console, and re-include it in your project. Manually verifying the contents of this file is error prone, so I'd just make a backup copy of the current file and replace it with the one you downloaded.

如果仍不能解决问题,请获得Firebase支持 google-services.json和其他信息,以获取个性化的故障排除帮助.

If that doesn't solve the problem, reach out to Firebase support with the google-services.json and other information for personalized help in troubleshooting.

这篇关于最新版本上的FirebaseInstallationsException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆