flutter-contacts-plugin
flutter-contacts-plugin copied to clipboard
Calling getContacts throws an exception on release built apk
🐛 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.
- 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:
- [ ] :iphone: iOS
- [x] :robot: Android
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