Firebase 消息传递仅在发布版本中使应用程序崩溃

Firebase messging crashes the app only in release build

我的应用程序使用 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)

问题已通过将以下代码添加到 /android/app/build.gradle 解决:

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

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

android.enableR8=false