NoSuchFieldError while using SqlCipher with ProGuard in Android app
Asked Answered
T

1

6

Due to security reasons one of the requirement is to encrypt the SQLite database. Hence, i had to use SQLCupher. The application work as expected as long as i do not enable Obfuscation using minifyEnabled true.

As soon as i set minifyEnabled true, i get a NoSuchFieldError.

I'm initializing the SQLCipher in the Application sub-class:

SQLiteDatabase.loadLibs(this);

Here is the exception log:

com.iconnectyo: runtime.cc:663] JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception java.lang.NoSuchFieldError: no "J" field "mNativeHandle" in class "Lnet/sqlcipher/database/SQLiteDatabase;" or its superclasses
    runtime.cc:663]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2)
    runtime.cc:663]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1131)
    runtime.cc:663]   at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1085)
    runtime.cc:663]   at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:1008)
    runtime.cc:663]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1664)
    runtime.cc:663]   at void net.sqlcipher.database.SQLiteDatabase$a.a(java.lang.String[]) (:213)
    runtime.cc:663]   at void net.sqlcipher.database.SQLiteDatabase.J(android.content.Context, java.io.File, net.sqlcipher.database.SQLiteDatabase$e) (:230)
    runtime.cc:663]   at void net.sqlcipher.database.SQLiteDatabase.I(android.content.Context, java.io.File) (:209)
    runtime.cc:663]   at void net.sqlcipher.database.SQLiteDatabase.H(android.content.Context) (:202)
    runtime.cc:663]   at void workplaceoptions.com.iconnectyou.activities.CustomApplication.onCreate() (:137)
    runtime.cc:663]   at void android.app.Instrumentation.callApplicationOnCreate(android.app.Application) (Instrumentation.java:1193)
    runtime.cc:663]   at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:6731)
    runtime.cc:663]   at void android.app.ActivityThread.access$1300(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:238)
    runtime.cc:663]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1914)
    runtime.cc:663]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    runtime.cc:663]   at void android.os.Looper.loop() (Looper.java:223)
    runtime.cc:663]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7697)
    runtime.cc:663]   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    runtime.cc:663]   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:592)
    runtime.cc:663]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:952)
    runtime.cc:663] 
    runtime.cc:663]     in call to FindClass
    runtime.cc:663]     from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class)
    
    --------- beginning of crash
375 27833-27833/workplaceoptions.com.iconnectyou A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 27833 (com.iconnectyou), pid 27833 (com.iconnectyou)
421 27884-27884/? E/DEBUG: failed to readlink /proc/27833/fd/75: No such file or directory
466 27884-27884/? I/crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
467 668-668/? I/tombstoned: received crash request for pid 27833
468 27884-27884/? I/crash_dump64: performing dump of process 27833 (target tid = 27833)
477 27884-27884/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
477 27884-27884/? A/DEBUG: Build fingerprint: 'Nokia/Phoenix_00WW/PNX_sprout:11/RKQ1.200906.002/00WW_6_21B:user/release-keys'
477 27884-27884/? A/DEBUG: Revision: '0'
477 27884-27884/? A/DEBUG: ABI: 'arm64'
477 27884-27884/? A/DEBUG: Timestamp: 20:23:57+0530
477 27884-27884/? A/DEBUG: pid: 27833, tid: 27833, name: com.iconnectyou  >>> workplaceoptions.com.iconnectyou <<<
477 27884-27884/? A/DEBUG: uid: 10649
477 27884-27884/? A/DEBUG: signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
477 27884-27884/? A/DEBUG: Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception java.lang.NoSuchFieldError: no "J" field "mNativeHandle" in class "Lnet/sqlcipher/database/SQLiteDatabase;" or its superclasses
        at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2)
        at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1131)
        at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1085)
        at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:1008)
        at void java.lang.System.loadLibrary(java.lang.String) (System.java:1664)
        at void net.sqlcipher.database.SQLiteDatabase$a.a(java.lang.String[]) (:213)
        at void net.sqlcipher.database.SQLiteDatabase.J(android.content.Context, java.io.File, net.sqlcipher.database.SQLiteDatabase$e) (:230)
        at void net.sqlcipher.database.SQLiteDatabase.I(android.content.Context, java.io.File) (:209)
        at void net.sqlcipher.database.SQLiteDatabase.H(android.content.Context) (:202)
        at void workplaceoptions.com.iconnectyou.activities.CustomApplication.onCreate() (:137)
        at void android.app.Instrumentation.callApplicationOnCreate(android.app.Application) (Instrumentation.java:1193)
        at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:6731)
        at void android.app.ActivityThread.access$1300(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:238)
        at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1914)
        at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
        at void android.os.Looper.loop() (Looper.java:223)
        at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7697)
        at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
        at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:592)
        at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:952)
    
        in call to FindClass
        from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class)'
477 27884-27884/? A/DEBUG:     x0  0000000000000000  x1  0000000000006cb9  x2  0000000000000006  x3  0000007fdc11f870
478 27884-27884/? A/DEBUG:     x4  0000007f4cf47000  x5  0000007f4cf47000  x6  0000007f4cf47000  x7  00000000000d8f1e
478 27884-27884/? A/DEBUG:     x8  00000000000000f0  x9  e25d60d1b8509bb5  x10 0000000000000000  x11 ffffffc0fffffbdf
478 27884-27884/? A/DEBUG:     x12 0000000000000001  x13 000000006113e485  x14 0015bb8e9a52d8d4  x15 00009e4839145201
478 27884-27884/? A/DEBUG:     x16 0000007f48a7ec80  x17 0000007f48a5f240  x18 0000007f4cc2a000  x19 0000000000006cb9
478 27884-27884/? A/DEBUG:     x20 0000000000006cb9  x21 00000000ffffffff  x22 0000000000000058  x23 0000000000000058
478 27884-27884/? A/DEBUG:     x24 0000007c55ba6f05  x25 0000000000000001  x26 0000007c55bbde40  x27 0000007c56173000
478 27884-27884/? A/DEBUG:     x28 0000007c76350cf0  x29 0000007fdc11f8f0
478 27884-27884/? A/DEBUG:     lr  0000007f48a0ebf8  sp  0000007fdc11f850  pc  0000007f48a0ec24  pst 0000000000000000
488 15788-15823/? D/TransportRuntime.SQLiteEventStore: Storing event with priority=DEFAULT, name=FIREPERF for destination cct
491 15788-15823/? D/TransportRuntime.JobInfoScheduler: Upload for context TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy1wYS5nb29nbGVhcGlzLmNvbS92MS9maXJlbG9nL2xlZ2FjeS9iYXRjaGxvZ1xBSXphU3lDY2traUg4aTJaQVJ3T3MxTEV6RktsZDE1YU9HOG96S28=) is already scheduled. Returning...
641 18873-20467/? I/AprUploadService.CmUp: PNX_PWM_356964091111267_1620694017532.zip is upload fail
700 0-0/? E/BBox: :EHCS;51600:i:info_psy: B{id=292000 is=0 st=[Full] ct=N/A l=100 ocv=4374030 v=4363270 c=102539 r=137938 cc=2 2 11 14 17 39 64 44 :100% FV(BATT_PROFILE_VOTER)=4400000 FCC(BATT_PROFILE_VOTER)=3400000 stl=0 t=390(Good)} U{p=1 o=0/1 type=USB [Source attached (default current)] v=4785156 c=474262 USB_ICL(USB_PSY_VOTER)=500000} M{fv=4395000 cc=3400000 icl=3400000 t=490} S{} D{p=0 o=0 c_max=0}
700 0-0/? E/info_sts: C{ 1006=45 1007=80 1009=79 100A=00 100B=96 100C=16 100D=00 100E=f4 1050=38 1051=02 1061=88 1070=79} O{ 1109=00 1152=00 1153=28} U{ 1306=01 1307=11 1308=01 1309=01 130B=80 130C=10 130D=80 130E=53 130F=00 1358=48 1359=73 135A=1b 1370=28} D{ 1406=00 1407=24 1408=01 1470=14} M{ 1606=02 1607=14 160A=40 160B=b5 1652=00}
717 27884-27884/? A/DEBUG: backtrace:
717 27884-27884/? A/DEBUG:       #00 pc 000000000004dc24  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: a6129197241eb9f68acb05fe7e48a951)
717 27884-27884/? A/DEBUG:       #01 pc 0000000000530564  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+2340) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #02 pc 000000000001394c  /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76) (BuildId: fdc879a76449eecdb87795db05dcc86a)
717 27884-27884/? A/DEBUG:       #03 pc 00000000000130cc  /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+312) (BuildId: fdc879a76449eecdb87795db05dcc86a)
717 27884-27884/? A/DEBUG:       #04 pc 0000000000368474  /apex/com.android.art/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+2596) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #05 pc 00000000003684ec  /apex/com.android.art/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+108) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #06 pc 000000000035a138  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+144) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #07 pc 0000000000358c6c  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::(anonymous namespace)::JniValueType)+1376) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #08 pc 000000000035800c  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::(anonymous namespace)::JniValueType*)+852) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #09 pc 000000000033f9ec  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::FindClass(_JNIEnv*, char const*)+696) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #10 pc 0000000000148360  /data/app/~~DQyl9fdq52zj05tiiH9Ewg==/workplaceoptions.com.iconnectyou-jGGM0Y0vhFt9IH2PcEz_mg==/lib/arm64/libsqlcipher.so (sqlcipher::register_android_database_SQLiteCompiledSql(_JNIEnv*)+36)
717 27884-27884/? A/DEBUG:       #11 pc 00000000001486f0  /data/app/~~DQyl9fdq52zj05tiiH9Ewg==/workplaceoptions.com.iconnectyou-jGGM0Y0vhFt9IH2PcEz_mg==/lib/arm64/libsqlcipher.so (JNI_OnLoad+64)
717 27884-27884/? A/DEBUG:       #12 pc 000000000036c484  /apex/com.android.art/lib64/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, _jclass*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+3344) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #13 pc 0000000000005130  /apex/com.android.art/lib64/libopenjdkjvm.so (JVM_NativeLoad+416) (BuildId: b116de4835b0b7f055658e583e0697ec)
717 27884-27884/? A/DEBUG:       #14 pc 0000000000080a24  /apex/com.android.art/javalib/arm64/boot.oat (art_jni_trampoline+228) (BuildId: a1bdd637637dad0eb6e60121071f95de7ab97a22)
717 27884-27884/? A/DEBUG:       #15 pc 00000000001327e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #16 pc 0000000000196eb0  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
717 27884-27884/? A/DEBUG:       #17 pc 0000000000301df0  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+376) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #18 pc 00000000002fcf08  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+884) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #19 pc 0000000000632ba8  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+548) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #20 pc 000000000012c994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #21 pc 00000000000e350e  /apex/com.android.art/javalib/core-oj.jar (java.lang.Runtime.nativeLoad+2)
718 27884-27884/? A/DEBUG:       #22 pc 0000000000632de4  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+1120) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #23 pc 000000000012c994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #24 pc 00000000000e3a40  /apex/com.android.art/javalib/core-oj.jar (java.lang.Runtime.loadLibrary0+92)
718 27884-27884/? A/DEBUG:       #25 pc 0000000000632584  /apex/com.android.art/lib64/libart.so (MterpInvokeDirect+1164) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #26 pc 000000000012c914  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #27 pc 00000000000e39cc  /apex/com.android.art/javalib/core-oj.jar (java.lang.Runtime.loadLibrary0+8)
718 27884-27884/? A/DEBUG:       #28 pc 000000000063005c  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+1440) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #29 pc 000000000012c814  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #30 pc 00000000000e8f94  /apex/com.android.art/javalib/core-oj.jar (java.lang.System.loadLibrary+16)
718 27884-27884/? A/DEBUG:       #31 pc 0000000000632de4  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+1120) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #32 pc 000000000012c994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #33 pc 00000000002d0624  [anon:dalvik-classes.dex extracted in memory from /data/app/~~DQyl9fdq52zj05tiiH9Ewg==/workplaceoptions.com.iconnectyou-jGGM0Y0vhFt9IH2PcEz_mg==/base.apk] (net.sqlcipher.database.SQLiteDatabase$a.a+12)
718 27884-27884/? A/DEBUG:       #34 pc 00000000006319f0  /apex/com.android.art/lib64/libart.so (MterpInvokeInterface+1840) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #35 pc 000000000012ca14  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_interface+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #36 pc 00000000002d1ee2  [anon:dalvik-classes.dex extracted in memory from /data/app/~~DQyl9fdq52zj05tiiH9Ewg==/workplaceoptions.com.iconnectyou-jGGM0Y0vhFt9IH2PcEz_mg==/base.apk] (net.sqlcipher.database.SQLiteDatabase.J+18)
718 27884-27884/? A/DEBUG:       #37 pc 00000000002f48e4  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.455116323805885647)+268) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #38 pc 00000000002fc5ac  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #39 pc 00000000002fceec  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+856) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #40 pc 0000000000632ba8  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+548) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #41 pc 000000000012c994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #42 pc 00000000002d1ea4  [anon:dalvik-classes.dex extracted in memory from /data/app/~~DQyl9fdq52zj05tiiH9Ewg==/workplaceoptions.com.iconnectyou-jGGM0Y0vhFt9IH2PcEz_mg==/base.apk] (net.sqlcipher.database.SQLiteDatabase.I+16)
718 27884-27884/? A/DEBUG:       #43 pc 00000000002f48e4  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.455116323805885647)+268) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #44 pc 00000000002fc5ac  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #45 pc 00000000002fceec  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+856) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #46 pc 0000000000632ba8  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+548) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #47 pc 000000000012c994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #48 pc 00000000002d1e66  [anon:dalvik-classes.dex extracted in memory from /data/app/~~DQyl9fdq52zj05tiiH9Ewg==/workplaceoptions.com.iconnectyou-jGGM0Y0vhFt9IH2PcEz_mg==/base.apk] (net.sqlcipher.database.SQLiteDatabase.H+14)
718 27884-27884/? A/DEBUG:       #49 pc 00000000002f48e4  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.455116323805885647)+268) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #50 pc 00000000002fc5ac  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #51 pc 00000000002fceec  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+856) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #52 pc 0000000000632ba8  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+548) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #53 pc 000000000012c994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #54 pc 000000000033f786  [anon:dalvik-classes.dex extracted in memory from /data/app/~~DQyl9fdq52zj05tiiH9Ewg==/workplaceoptions.com.iconnectyou-jGGM0Y0vhFt9IH2PcEz_mg==/base.apk] (workplaceoptions.com.iconnectyou.activities.CustomApplication.onCreate+118)
718 27884-27884/? A/DEBUG:       #55 pc 000000000063005c  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+1440) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #56 pc 000000000012c814  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #57 pc 0000000000212828  /system/framework/framework.jar (android.app.Instrumentation.callApplicationOnCreate)
718 27884-27884/? A/DEBUG:       #58 pc 00000000002f48e4  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.455116323805885647)+268) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #59 pc 00000000002fc5ac  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #60 pc 00000000002fd88c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, true>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1780) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #61 pc 000000000016b13c  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<true, false>(art::interpreter::SwitchImplContext*)+45276) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #62 pc 000000000013e7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #63 pc 000000000019c9e0  /system/framework/framework.jar (android.app.ActivityThread.handleBindApplication)
718 27884-27884/? A/DEBUG:       #64 pc 00000000002f49ec  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.455116323805885647)+532) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #65 pc 00000000002fc5ac  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #66 pc 00000000002fd88c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, true>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1780) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #67 pc 000000000016b13c  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<true, false>(art::interpreter::SwitchImplContext*)+45276) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #68 pc 000000000013e7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #69 pc 0000000000199f64  /system/framework/framework.jar (android.app.ActivityThread.access$1300)
718 27884-27884/? A/DEBUG:       #70 pc 00000000002f49ec  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.455116323805885647)+532) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #71 pc 00000000002fc5ac  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)
718 27884-27884/? A/DEBUG:       #72 pc 00000000002fceec  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+856) (BuildId: 9a4d2f9f4e86792f0df63da0fe8a8189)

As suggested on many of the blogs like :

https://discuss.zetetic.net/t/native-runtime-crash-from-sqlcipher-for-android/1096

Android Proguard SqlCipher NoClassDefFoundError

Getting NoClassDefFoundError while trying to use Proguard and SQLcipher in Android

I have changed my proguard configuration file as shown below:

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

-keep class net.sqlcipher.** { *; }
-dontwarn net.sqlcipher.**

Here is how my debug buildType is defined in the app's grable file:

debug {
            minifyEnabled true
            shrinkResources true
            signingConfig getSigningConfig()
            ndk {
                abiFilters "armeabi", "armeabi-v7a", "x86", "mips", "x86_64", "arm64-v8a"
            }
        }

Here is my apk structure using Build Analzser:

enter image description here

Kindly provide suggestion on why i might be getting this error/Crash. Is something wrong with my proguard configuration?

P.S. In my case i need enable code Obfuscation. So, i cannot set minifyEnabled false in buildType.

Tartrate answered 11/8, 2021 at 15:20 Comment(0)
T
9

I was able to solve the issue by adding the below line in proguard rules:

-libraryjars libs/sqlcipher.jar

followed by:

-keep class net.sqlcipher.** { *; }
-keep class net.sqlcipher.database.** { *; }
Tartrate answered 17/8, 2021 at 8:2 Comment(2)
Thank you for this! In my case, I didn't need the -libraryjars line (I don't have that jar file), but the -keep class statements fixed the problem.Consider
In my caae I've just added just the 2 -keep lines of code and it worked for me.Placate

© 2022 - 2024 — McMap. All rights reserved.