Search code examples
androidandroid-ndkandroid-7.0-nougatsqlciphersqlcipher-android

Android 7.0 Native crashes due to sqlcipher library and NDK restrictions


I'm receiving following crash on Android 7.0 Samsung S8 and many other such native crashes:

backtrace:
#00  pc 000000000005da7c  /system/lib64/libbinder.so (_ZN7android6Parcel14freeDataNoInitEv+16)
#01  pc 00000000000f8538  /system/lib64/libandroid_runtime.so
#02  pc 0000000002a4fa24  /system/framework/arm64/boot-framework.oat (android.os.Parcel.nativeDestroy+128)
#03  pc 0000000002a4ee10  /system/framework/arm64/boot-framework.oat (android.os.Parcel.destroy+76)
#04  pc 0000000002a5396c  /system/framework/arm64/boot-framework.oat (android.os.Parcel.finalize+40)
#05  pc 000000000068a6e0  /system/framework/arm64/boot-core-libart.oat (java.lang.Daemons$FinalizerDaemon.doFinalize+140)
#06  pc 000000000068a9bc  /system/framework/arm64/boot-core-libart.oat (java.lang.Daemons$FinalizerDaemon.runInternal+520)
#07  pc 000000000068a054  /system/framework/arm64/boot-core-libart.oat (java.lang.Daemons$Daemon.run+96)
#08  pc 000000000065fda0  /system/framework/arm64/boot.oat (java.lang.Thread.run+60)
#09  pc 00000000000d25b4  /system/lib64/libart.so (art_quick_invoke_stub+580)
#10  pc 00000000000df6e4  /system/lib64/libart.so (_Z N3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+212)
#11  pc 0000000000475fc4  /system/lib64/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+108)
#12  pc 0000000000477598  /system/lib64/libart.so (_ZN3art35InvokeVirtualOrInterfaceWithJValuesERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDP6jvalue+372)
#13  pc 00000000004988a8  /system/lib64/libart.so (_ZN3art6Thread14CreateCallbackEPv+1104)
#14  pc 00000000000770f4  /system/lib64/libc.so (_ZL15__pthread_startPv+204)
#15  pc 000000000001e7d0  /system/lib64/libc.so (__start_thread+16)

This crash was logged on play store. It keeps repeating for every build update we provide on play store.

Below library is used in my app, which is the only library that uses jni code from NDK.

compile 'net.zetetic:android-database-sqlcipher:3.5.9@aar'
compile 'org.greenrobot:greendao:3.0.1'

SQLCipher Library from Github

Greendao Library from Github

NDK Restrictions on Android 7.0

Please help to resolve this crash issue. It is increasing day by day for my app. See below image:

Play store crashes

Github Issue Link


Solution

  • please verify you have not stored any Parcelable Objects in persistent storage like shared preferences or local sqlite db.

    Parcel is not a general-purpose serialization mechanism. This class (and the corresponding Parcelable API for placing arbitrary objects into a Parcel) is designed as a high-performance IPC transport. As such, it is not appropriate to place any Parcel data in to persistent storage: changes in the underlying implementation of any of the data in the Parcel can render older data unreadable.