Flutter AWS Cognito app in release mode crashes on Android

273 Views Asked by At

I have created a Flutter application that uses amplify_auth_cognito and amplify_core packages for authentication.

In debug mode, the app works fine without any issues. The iOS version works fine as well, even when installed from the TestFlight.

However, when I run in release mode created apk on a physical Android device, whenever I click on a button that calls Amplify.Auth.signIn(username, password) function, the whole app crashes.

App crash log says:

time: 1604934616377
msg: java.lang.NoSuchFieldException: SUCCESS
stacktrace: java.lang.AssertionError: java.lang.NoSuchFieldException: SUCCESS
    at c.b.b.w.n.n$j0.<init>(Unknown Source:87)
    at c.b.b.w.n.n$w.a(Unknown Source:29)
    at c.b.b.e.a(Unknown Source:74)
    at c.b.b.w.n.i.a(Unknown Source:42)
    at c.b.b.w.n.i.a(Unknown Source:123)
    at c.b.b.w.n.i.a(Unknown Source:22)
    at c.b.b.e.a(Unknown Source:74)
    at c.b.b.e.a(Unknown Source:4)
    at c.b.b.e.a(Unknown Source:8)
    at c.b.b.e.a(Unknown Source:5)
    at c.b.b.e.a(Unknown Source:13)
    at com.amazonaws.amplify.amplify_auth_cognito.types.FlutterFetchCognitoAuthSessionResult.a(Unknown Source:4)
    at com.amazonaws.amplify.amplify_auth_cognito.types.FlutterFetchCognitoAuthSessionResult.a(Unknown Source:42)
    at com.amazonaws.amplify.amplify_auth_cognito.AuthCognito$prepareCognitoSessionResult$1.run(Unknown Source:8)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7398)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: java.lang.NoSuchFieldException: SUCCESS
    at java.lang.Class.getField(Class.java:1604)
    at c.b.b.w.n.n$j0.<init>(Unknown Source:34)
    ... 20 more

Any idea why is this happening and how to fix it?

0

There are 0 best solutions below