【问题标题】:Firebase messging crashes the app only in release buildFirebase 消息传递仅在发布版本中使应用程序崩溃
【发布时间】:2021-12-17 04:04:20
【问题描述】:

我的应用程序使用 Firebase 消息传递,并且该应用程序在调试模式下工作正常,但是当我在发布模式下构建它时,它会在收到来自 Firebase 的消息时崩溃。我假设 onMessage.listen 以某种方式使应用程序崩溃。我测试它的设备是 Android 设备。在应用内的 Firebase 设置过程中,我是否有任何遗漏的地方,或者是否有任何已知的修复方法?

编辑 - 这是我得到的错误:

E/AndroidRuntime(26859): FATAL EXCEPTION: firebase-iid-executor
E/AndroidRuntime(26859): Process: com.company.scrcapp, PID: 26859
E/AndroidRuntime(26859): java.lang.IllegalAccessError: Illegal class access: 'b.c.a.b.d.a' attempting to access 'b.c.a.b.b.a.c' (declaration of 'b.c.a.b.d.a' appears in base.apk)
E/AndroidRuntime(26859):        at b.c.a.b.d.a.<init>(Unknown Source:169)
E/AndroidRuntime(26859):        at b.c.a.b.d.a.<init>(:1)
E/AndroidRuntime(26859):        at com.google.firebase.messaging.l0.b(:1)
E/AndroidRuntime(26859):        at com.google.firebase.messaging.Y.e(:2)
E/AndroidRuntime(26859):        at com.google.firebase.messaging.m.call(:1)
E/AndroidRuntime(26859):        at b.c.a.b.e.F.run(Unknown Source:4)
E/AndroidRuntime(26859):        at com.google.firebase.messaging.n.execute(Unknown Source:0)
E/AndroidRuntime(26859):        at b.c.a.b.e.m.c(Unknown Source:20)
E/AndroidRuntime(26859):        at com.google.firebase.messaging.o.c(:1)
E/AndroidRuntime(26859):        at b.c.a.b.a.a.b(:1)
E/AndroidRuntime(26859):        at b.c.a.b.a.a.a(Unknown Source:21)
E/AndroidRuntime(26859):        at b.c.a.b.a.g.run(Unknown Source:10)
E/AndroidRuntime(26859):        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(26859):        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(26859):        at com.google.android.gms.common.util.e.b.run(Unknown Source:6)
E/AndroidRuntime(26859):        at java.lang.Thread.run(Thread.java:923)

【问题讨论】:

  • 您是否更改了Sha-1并再次下载了json文件?你得到了 Sha-1 发行版吗?
  • 安卓还是ios?
  • @mariofrancois 我没有检查项目设置中的 sha 1 选项,应该吗?
  • @GbengaBAyannuga 它在 android 上
  • 我最后一次面对这个是在 ios 上

标签: firebase flutter dart firebase-cloud-messaging flutter-dependencies


【解决方案1】:

通过在/android/app/build.gradle添加以下代码解决了问题:

...
buildTypes {
        release {
            ...
            shrinkResources false
            minifyEnabled false
        }
    }

并将下面的代码添加到/android/gradle.properties:

android.enableR8=false

【讨论】:

  • 兄弟,你救了我,对我来说,它只是在运行 android 7 的设备上崩溃。
猜你喜欢
  • 2017-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多