我创建了一个使用amplify_auth_cognito和amplify_core包进行身份验证的 Flutter 应用程序。
在调试模式下,应用程序运行良好,没有任何问题。即使从 TestFlight 安装,iOS 版本也可以正常工作。
但是,当我在物理 Android 设备上以发布模式运行创建的 apk 时,每当我单击调用Amplify.Auth.signIn(username, password)
函数的按钮时,整个应用程序都会崩溃。
应用程序崩溃日志说:
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
知道为什么会发生这种情况以及如何解决吗?