kforjan
kforjan

Reputation: 1394

Firebase messging crashes the app only in release build

My (Flutter) mobile application uses Firebase messaging and it works fine in debug mode, but when I run/build it in the release mode it crashes upon receiving a message from Firebase. I suspect that onMessage.listen somehow crashes the app. It happens only on Android devices.

Is there anything that I could've missed during the Firebase project setup or within the Android app configuration?

The following error logs are produced upon receiving a message:

E/AndroidRuntime(26859): FATAL EXCEPTION: firebase-iid-executor
E/AndroidRuntime(26859): Process: com.company.app, 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)

Upvotes: 1

Views: 1173

Answers (1)

kforjan
kforjan

Reputation: 1394

The problem was solved by adding code below to /android/app/build.gradle:

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

and adding code below to /android/gradle.properties:

android.enableR8=false

Upvotes: 5

Related Questions