【问题标题】:FirebaseApp was deletedFirebaseApp 已删除
【发布时间】:2021-01-20 12:46:29
【问题描述】:

在我将使用结构集成的应用程序更改为 firebase Crashlytics 后,该应用程序开始在 HMS 设备上崩溃并给出如下错误。我在使用 Google Play 设备时没有任何问题。我更改了 google-service.json,之后可以查看崩溃信息。

有人有cmet吗?

-------Gradles------(实际的firebase实现)

implementation "com.google.firebase:firebase-messaging:20.1.0"
implementation "com.google.firebase:firebase-core:17.2.3"
implementation "com.google.firebase:firebase-config:19.1.2"
implementation "com.google.firebase:firebase-iid:20.0.2"

implementation('com.google.firebase:firebase-crashlytics:17.3.0') {
    transitive = true
}
implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation ("android.arch.work:work-firebase:1.0.0-alpha11")

-------日志-----

2021-01-20 14:11:34.525 27076-27135/MY-APPLICATION W/Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [403 Forbidden: {
      "error": {
        "code": 403,
        "message": "Requests from this Android client application MY-APPLICATION are blocked.",
        "status": "PERMISSION_DENIED",
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.ErrorInfo",
            "reason": "API_KEY_ANDROID_APP_BLOCKED",
            "domain": "googleapis.com",
            "metadata": {
              "service": "firebaseinstallations.googleapis.com",
              "consumer": "projects/651311591439"
            }
          }
        ]
      }
    }
    ]
2021-01-20 14:11:34.525 27076-27135/MY-APPLICATION W/Firebase-Installations: Firebase options used while communicating with Firebase server APIs: AIzaSyCFTn7-Nq2MuhBLaxtFteIHomgj-yaTtyU, upcall-7aaf6, 1:651311591439:android:06c16ecc4c04ca0b
2021-01-20 14:11:34.525 27076-27135/MY-APPLICATION 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.
2021-01-20 14:11:34.528 27076-27135/MY-APPLICATION I/QarthLog: [PatchStore] createDisableExceptionQarthFile
2021-01-20 14:11:34.528 27076-27135/MY-APPLICATION I/QarthLog: [PatchStore] create disable file for MY-APPLICATION uid is 10171
2021-01-20 14:11:34.529 27076-27176/MY-APPLICATION I/QarthLog: [PatchStore] createDisableExceptionQarthFile
2021-01-20 14:11:34.529 27076-27176/MY-APPLICATION I/QarthLog: [PatchStore] create disable file for MY-APPLICATION uid is 10171
2021-01-20 14:11:34.530 27076-27177/MY-APPLICATION I/QarthLog: [PatchStore] createDisableExceptionQarthFile
2021-01-20 14:11:34.530 27076-27177/MY-APPLICATION I/QarthLog: [PatchStore] create disable file for MY-APPLICATION uid is 10171
2021-01-20 14:11:34.531 27076-27178/MY-APPLICATION I/QarthLog: [PatchStore] createDisableExceptionQarthFile
2021-01-20 14:11:34.531 27076-27178/MY-APPLICATION I/QarthLog: [PatchStore] create disable file for MY-APPLICATION uid is 10171
    
    --------- beginning of crash
2021-01-20 14:11:34.531 27076-27176/MY-APPLICATION E/AndroidRuntime: FATAL EXCEPTION: firebase-installations-executor-3
    Process: MY-APPLICATION, PID: 27076
    java.lang.IllegalStateException: FirebaseApp was deleted
        at com.google.android.gms.common.internal.Preconditions.checkState(Unknown Source:29)
        at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:438)
        at com.google.firebase.FirebaseApp.getApplicationContext(FirebaseApp.java:125)
        at com.google.firebase.installations.FirebaseInstallations.getMultiProcessSafePrefs(FirebaseInstallations.java:578)
        at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:355)
        at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)
2021-01-20 14:11:34.532 27076-27180/MY-APPLICATION I/QarthLog: [PatchStore] createDisableExceptionQarthFile
2021-01-20 14:11:34.532 27076-27180/MY-APPLICATION I/QarthLog: [PatchStore] create disable file for MY-APPLICATION uid is 10171
2021-01-20 14:11:34.532 27076-27177/MY-APPLICATION E/AndroidRuntime: FATAL EXCEPTION: firebase-installations-executor-4
    Process: MY-APPLICATION, PID: 27076
    java.lang.IllegalStateException: FirebaseApp was deleted
        at com.google.android.gms.common.internal.Preconditions.checkState(Unknown Source:29)
        at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:438)
        at com.google.firebase.FirebaseApp.getApplicationContext(FirebaseApp.java:125)
        at com.google.firebase.installations.FirebaseInstallations.getMultiProcessSafePrefs(FirebaseInstallations.java:578)
        at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:355)
        at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)
2021-01-20 14:11:34.533 27076-27135/MY-APPLICATION E/AndroidRuntime: FATAL EXCEPTION: firebase-installations-executor-2
    Process: MY-APPLICATION, PID: 27076
    java.lang.IllegalStateException: FirebaseApp was deleted
        at com.google.android.gms.common.internal.Preconditions.checkState(Unknown Source:29)
        at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:438)
        at com.google.firebase.FirebaseApp.getApplicationContext(FirebaseApp.java:125)
        at com.google.firebase.installations.FirebaseInstallations.insertOrUpdatePrefs(FirebaseInstallations.java:401)
        at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:374)
        at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)
2021-01-20 14:11:34.536 981-27179/? I/QarthDisFileCreator: pattern not match
2021-01-20 14:11:34.538 981-27181/? I/QarthDisFileCreator: pattern not match
2021-01-20 14:11:34.538 981-27184/? I/QarthDisFileCreator: pattern not match
2021-01-20 14:11:34.538 27076-27183/MY-APPLICATION I/QarthLog: [PatchStore] createDisableExceptionQarthFile
2021-01-20 14:11:34.538 27076-27183/MY-APPLICATION I/QarthLog: [PatchStore] create disable file for MY-APPLICATION uid is 10171
2021-01-20 14:11:34.539 27076-27178/MY-APPLICATION E/AndroidRuntime: FATAL EXCEPTION: firebase-installations-executor-5
    Process: MY-APPLICATION, PID: 27076
    java.lang.IllegalStateException: FirebaseApp was deleted
        at com.google.android.gms.common.internal.Preconditions.checkState(Unknown Source:29)
        at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:438)
        at com.google.firebase.FirebaseApp.getApplicationContext(FirebaseApp.java:125)
        at com.google.firebase.installations.FirebaseInstallations.getMultiProcessSafePrefs(FirebaseInstallations.java:578)
        at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:355)
        at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)
2021-01-20 14:11:34.539 27076-27180/MY-APPLICATION E/AndroidRuntime: FATAL EXCEPTION: firebase-installations-executor-6
    Process: MY-APPLICATION, PID: 27076
    java.lang.IllegalStateException: FirebaseApp was deleted
        at com.google.android.gms.common.internal.Preconditions.checkState(Unknown Source:29)
        at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:438)
        at com.google.firebase.FirebaseApp.getApplicationContext(FirebaseApp.java:125)
        at com.google.firebase.installations.FirebaseInstallations.getMultiProcessSafePrefs(FirebaseInstallations.java:578)
        at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:355)
        at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)
2021-01-20 14:11:34.540 981-27182/? I/QarthDisFileCreator: pattern not match
2021-01-20 14:11:34.540 981-27186/? I/QarthDisFileCreator: pattern not match
2021-01-20 14:11:34.540 27076-27183/MY-APPLICATION E/AndroidRuntime: FATAL EXCEPTION: firebase-installations-executor-7
    Process: MY-APPLICATION, PID: 27076
    java.lang.IllegalStateException: FirebaseApp was deleted
        at com.google.android.gms.common.internal.Preconditions.checkState(Unknown Source:29)
        at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:438)
        at com.google.firebase.FirebaseApp.getApplicationContext(FirebaseApp.java:125)
        at com.google.firebase.installations.FirebaseInstallations.getMultiProcessSafePrefs(FirebaseInstallations.java:578)
        at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:355)
        at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)

【问题讨论】:

  • 华为不允许使用谷歌服务。意味着你不能使用firebase。你必须使用别的东西。
  • 问题解决了吗。如果是这样,如何?

标签: android firebase crashlytics firebase-analytics huawei-mobile-services


【解决方案1】:

Firebase Crashlytics 不依赖于 GMS,但如果您同时使用任何其他依赖于 GMS 的服务,请使用替代 HMS 服务。此外,华为有自己的 AG 连接崩溃服务。 可以集成HMS crash,请参考以下文档details

其他可能性,如果您最近更改了 google-services.json 文件,请尝试从 android 项目中删除构建文件夹并重新构建。

【讨论】:

    【解决方案2】:
    1. 您已集成firebase-crashlytics

    Firebase SDK 可分为三类: Play 服务 必需的;推荐播放服务;不需要播放服务

    根据Firebase documentation,Crashlytics 不依赖于 GMS。因此,该错误与HMS设备无关。

    1. 您的应用集成了 GMS。由于新的华为手机被禁止使用 GMS,如果您的应用程序集成了 GMS,将无法在新的华为手机上运行。如果您希望您的应用在这些手机上运行,​​请集成华为移动服务 (HMS)。

    在您提供的列表中,您使用以下 GMS 服务: • firebase 消息传递 • firebase 分析

    您可以参考以下华为移动服务: Push Kit, Analytics Kit

    1. 建议您使用GMS和HMS集成的解决方案。优点如下:
    • 降低应用打包的复杂性。一个包可以同时发布到 Google Play 和 HUAWEI AppGallery。
    • 降低代码维护成本。 HMS+GMS适配层代码是在原逻辑代码的基础上增加的。这样就可以根据手机自动调用正确的代码。即不需要修改现有的逻辑代码,也不需要维护两套代码。

    建议您使用HUAWEI HMS ToolKit,它可以帮助您快速添加HMS+GMS适配层代码,升级您的逻辑代码以同时支持GMS和HMS。

    请参考这些 SOF 答案:

    https://stackoverflow.com/a/64782622/13329100

    https://stackoverflow.com/a/64874560/13329100

    【讨论】:

      猜你喜欢
      • 2022-07-22
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 2023-01-12
      • 1970-01-01
      • 2014-02-02
      • 2018-01-23
      • 1970-01-01
      相关资源
      最近更新 更多