-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter Release APK crashes with GSON error java.lang.AssertionError: AssertionError (GSON 2.8.5): java.lang.NoSuchFieldException: UNKNOWN E/flutter (14343): #1456
Comments
It's not clear why this is a Gson problem. It looks like obfuscation removed a field. Can you provide a self-contained sample that fails and demonstrates that Gson has a bug? |
@JakeWharton I honestly do not know the steps to reproduce this error. It popped up whilst installing my release apk in Flutter and it explicitly states |
I figured the culprit here. It happens when minifyEnabled is set to true. So just disable it and it should fix I commented these on my app/build.gradle and now works
|
You saved me a lot of headaches, @nemoryoliver ! |
I can feel you @burkard . So happy I've helped. You're welcome |
FYI, you are disabling your proguard!! be careful! |
Add the below in proguard-rules.pro, it will be fixed!
|
I seem to have solved this with |
Thanks for your help!You exactly saved me. |
do we have another alternative to use shrink |
Probably same issue as #924 |
Add these lines of code, fixed for me buildTypes {
release {
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
} |
It worked! |
Flutter release-apk crashes as soon as I open the app with a GSON error
Error Log
[ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(40)] java.lang.AssertionError: AssertionError (GSON 2.8.5): java.lang.NoSuchFieldException: UNKNOWN
E/flutter (14343): at com.google.a.f.a(Unknown Source)
E/flutter (14343): at com.google.a.f.a(Unknown Source)
E/flutter (14343): at com.google.a.f.a(Unknown Source)
E/flutter (14343): at com.b.a.b.a$a.b(Unknown Source)
E/flutter (14343): at com.b.a.a.onMethodCall(Unknown Source)
E/flutter (14343): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source)
E/flutter (14343): at io.flutter.view.FlutterNativeView.handlePlatformMessage(Unknown Source)
E/flutter (14343): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (14343): at android.os.MessageQueue.next(MessageQueue.java:143)
E/flutter (14343): at android.os.Looper.loop(Looper.java:130)
E/flutter (14343): at android.app.ActivityThread.main(ActivityThread.java:6117)
E/flutter (14343): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (14343): at java.lang.reflect.Method.invoke(Method.java:372)
E/flutter (14343): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
E/flutter (14343): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
E/flutter (14343): Caused by: java.lang.AssertionError: java.lang.NoSuchFieldException: UNKNOWN
E/flutter (14343): at com.google.a.b.a.n$a.(Unknown Source)
E/flutter (14343): at com.google.a.b.a.n$24.a(Unknown Source)
E/flutter (14343): at com.google.a.f.a(Unknown Source)
E/flutter (14343): at com.google.a.b.a.a$1.a(Unknown Source)
E/flutter (14343): at com.google.a.f.a(Unknown Source)
E/flutter (14343): ... 15 more
E/flutter (14343): Caused by: java.lang.NoSuchFieldException: UNKNOWN
E/flutter (14343): at java.lang.Class.getField(Class.java:1104)
E/flutter (14343): ... 20 more
E/flutter (14343):
F/flutter (14343): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env).
The text was updated successfully, but these errors were encountered: