Skip to content
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

Calling getContacts throws an exception on release built apk #11

Open
1 of 2 tasks
korenzerah opened this issue Nov 27, 2018 · 1 comment
Open
1 of 2 tasks

Calling getContacts throws an exception on release built apk #11

korenzerah opened this issue Nov 27, 2018 · 1 comment

Comments

@korenzerah
Copy link

🐛 Bug Report

Exception is thrown after this line:
final dynamic jsonString = await _channel.invokeMethod('getContacts');

Exception details:
E/flutter (31579): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(40)] java.lang.AssertionError: AssertionError (GSON 2.8.5): java.lang.NoSuchFieldException: HOME
E/flutter (31579): at com.d.a.f.a(Unknown Source:73)
E/flutter (31579): at com.d.a.f.a(Unknown Source:8)
E/flutter (31579): at com.d.a.f.a(Unknown Source:5)
E/flutter (31579): at com.d.a.f.a(Unknown Source:13)
E/flutter (31579): at com.a.a.c.a$a.a(Unknown Source:12)
E/flutter (31579): at com.a.a.b.onMethodCall(Unknown Source:33)
E/flutter (31579): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17)
E/flutter (31579): at io.flutter.view.FlutterNativeView.handlePlatformMessage(Unknown Source:26)
E/flutter (31579): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (31579): at android.os.MessageQueue.next(MessageQueue.java:326)
E/flutter (31579): at android.os.Looper.loop(Looper.java:160)
E/flutter (31579): at android.app.ActivityThread.main(ActivityThread.java:6863)
E/flutter (31579): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (31579): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
E/flutter (31579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter (31579): Caused by: java.lang.AssertionError: java.lang.NoSuchFieldException: HOME
E/flutter (31579): at com.d.a.b.a.n$a.(Unknown Source:87)
E/flutter (31579): at com.d.a.b.a.n$24.a(Unknown Source:29)
E/flutter (31579): at com.d.a.f.a(Unknown Source:74)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:42)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:122)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:22)
E/flutter (31579): at com.d.a.f.a(Unknown Source:74)
E/flutter (31579): at com.d.a.b.a.b.a(Unknown Source:26)
E/flutter (31579): at com.d.a.f.a(Unknown Source:74)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:42)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:122)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:22)
E/flutter (31579): at com.d.a.f.a(Unknown Source:74)
E/flutter (31579): at com.d.a.b.a.m.a(Unknown Source:18)
E/flutter (31579): at com.d.a.b.a.b$a.a(Unknown Source:25)
E/flutter (31579): at com.d.a.b.a.b$a.a(Unknown Source:2)
E/flutter (31579): at com.d.a.f.a(Unknown Source:34)
E/flutter (31579): ... 14 more
E/flutter (31579): Caused by: java.lang.NoSuchFieldException: HOME
E/flutter (31579): at java.lang.Class.getField(Class.java:1601)
E/flutter (31579): at com.d.a.b.a.n$a.(Unknown Source:34)
E/flutter (31579): ... 30 more
E/flutter (31579):
F/flutter (31579): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env).

  • The classes are minified after proguard. It might cause the exception.
  • Notice this line in the exception: java.lang.NoSuchFieldException: HOME

Expected behavior

Get the contacts

Reproduction steps

call getContacts method

Configuration

Version: 0.0.3

Platform:

  • 📱 iOS
  • 🤖 Android
@oliverbytes
Copy link

oliverbytes commented Feb 9, 2019

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

buildTypes {
        release {
                .........
                minifyEnabled false // set this to false to prevent java.lang.NoSuchFieldException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants