SaltechSystems / couchbase_lite

Flutter plugin for the Community edition of Couchbase Lite. Couchbase Lite is an embedded lightweight, document-oriented (NoSQL), syncable database engine.
MIT License
60 stars 28 forks source link

App from PlayStore crashes #60

Closed richardkrieger closed 4 years ago

richardkrieger commented 4 years ago

Problem: USB debug works. After downloading from PlayStore, the app will not work. This is caused by R8 minimization

Reproduce errors locally: android/app/build.gradle, area buildTypes

buildTypes {
    debug {
        debuggable true
        minifyEnabled true
        signingConfig signingConfigs.release
    }
    release {
        signingConfig signingConfigs.release
    }
}

with "minifyEnabled true" you get errors in Logcat:

07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.NoSuchMethodError: no static method "Lcom/couchbase/lite/internal/core/C4DatabaseObserver;.callback(J)V"
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void b.a.a.g0.a(android.content.Context) (:63)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void b.b.a.c.<init>(c.a.b.a.l$c) (:97)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void b.b.a.c.a(c.a.b.a.l$c) (:70)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void io.flutter.plugins.GeneratedPluginRegistrant.registerWith(io.flutter.embedding.engine.a) (:18)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void io.flutter.embedding.android.d.c(io.flutter.embedding.engine.a) (:972)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void io.flutter.embedding.android.d.a(io.flutter.embedding.engine.a) (:873)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void io.flutter.embedding.android.e.a(android.content.Context) (:178)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void io.flutter.embedding.android.d.onCreate(android.os.Bundle) (:409)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6877)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1136)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:3209)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:3352)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.access$1100(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:223)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1797)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void android.os.Looper.loop() (Looper.java:158)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7231)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1230)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1120)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410] 
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]     in call to NewGlobalRef
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]     from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410] "main" prio=5 tid=1 Runnable
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x760a8598 self=0xb48f6500
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   | sysTid=10249 nice=-11 cgrp=default sched=0/0 handle=0xb6fc0b4c
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 163903902 109134544 175 ) utm=9 stm=7 core=0 HZ=100
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   | stack=0xbe057000-0xbe059000 stackSize=8MB
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #00 pc 0035d135  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiPKcPNS_9ArtMethodEPv+116)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #01 pc 0033dc13  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+138)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #02 pc 0024fe89  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+760)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #03 pc 00250527  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+54)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #04 pc 000fbe0b  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+30)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #05 pc 00100ce7  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+5054)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #06 pc 0011249d  /system/lib/libart.so (_ZN3art8CheckJNI12NewGlobalRefEP7_JNIEnvP8_jobject+376)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #07 pc 00336bb9  /system/lib/libart.so (_ZN3art6Thread22SetClassLoaderOverrideEP8_jobject+32)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #08 pc 00250a89  /system/lib/libart.so (_ZN3art9JavaVMExt17LoadNativeLibraryEP7_JNIEnvRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEP8_jobjectPS9_+1228)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #09 pc 002c29c7  /system/lib/libart.so (_ZN3artL18Runtime_nativeLoadEP7_JNIEnvP7_jclassP8_jstringP8_jobjectS5_+178)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   native: #10 pc 0020d04d  /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+144)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.nativeLoad(Native method)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.doLoad(Runtime.java:435)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   - locked <0x03bf20e1> (a java.lang.Runtime)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.System.loadLibrary(System.java:1076)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at b.a.a.g0.a(:63)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at b.b.a.c.<init>(:97)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at b.b.a.c.a(:70)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(:18)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.reflect.Method.invoke!(Native method)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at io.flutter.embedding.android.d.c(:972)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at io.flutter.embedding.android.d.a(:873)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at io.flutter.embedding.android.e.a(:178)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at io.flutter.embedding.android.d.onCreate(:409)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.app.Activity.performCreate(Activity.java:6877)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3209)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3352)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.access$1100(ActivityThread.java:223)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.os.Handler.dispatchMessage(Handler.java:102)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.os.Looper.loop(Looper.java:158)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.main(ActivityThread.java:7231)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.reflect.Method.invoke!(Native method)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/java_vm_ext.cc:410] 
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/runtime.cc:368] Runtime aborting...
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/art: art/runtime/runtime.cc:368] 
07-30 18:37:17.760 10249-10249/de.trames.umkreis A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 10249 (.trames.umkreis)

Currently release can only be created with "flutter build appbundle --no-shrink"

bawelter commented 4 years ago

Add this to your pro guard rules

# Couchbase
-keep public class com.couchbase.lite.** { *; }
-dontwarn com.couchbase.lite.**
-keep public class com.couchbase.litecore.** { *; }
-dontwarn com.couchbase.litecore.**
richardkrieger commented 4 years ago

It's working. Thanks for the help!