SQLiteDatabase.loadLibs() problem


#1

The sql cipher run perfectly fine on Ice Cream Sandwich an Jelly Bean device but when I install the app on Android Version 4.4.2 (KitKat) the app crash . After debugging it seem it crash because of the method SQLiteDatabase.loadLibs().Below is the log file of the problem.


    11-18 05:05:27.292: D/dalvikvm(2261): Trying to load lib /data/app-lib/com.sns.app-1/libstlport_shared.so 0x41a76678
11-18 05:05:27.362: D/dalvikvm(2261): Added shared lib /data/app-lib/com.sns.app-1/libstlport_shared.so 0x41a76678
11-18 05:05:27.362: D/dalvikvm(2261): No JNI_OnLoad found in /data/app-lib/com.sns.app-1/libstlport_shared.so 0x41a76678, skipping init
11-18 05:05:27.362: D/dalvikvm(2261): Trying to load lib /data/app-lib/com.sns.app-1/libsqlcipher_android.so 0x41a76678
11-18 05:05:27.422: D/dalvikvm(2261): Added shared lib /data/app-lib/com.sns.app-1/libsqlcipher_android.so 0x41a76678
11-18 05:05:27.422: D/dalvikvm(2261): No JNI_OnLoad found in /data/app-lib/com.sns.app-1/libsqlcipher_android.so 0x41a76678, skipping init
11-18 05:05:27.432: D/dalvikvm(2261): Trying to load lib /data/app-lib/com.sns.app-1/libdatabase_sqlcipher.so 0x41a76678
11-18 05:05:27.442: E/dalvikvm(2261): dlopen("/data/app-lib/com.sns.app-1/libdatabase_sqlcipher.so") failed: dlopen failed: cannot locate symbol "_ZN7android10MemoryBaseC1ERKNS_2spINS_11IMemoryHeapEEElj" referenced by "libdatabase_sqlcipher.so"...
11-18 05:05:27.452: D/AndroidRuntime(2261): Shutting down VM
11-18 05:05:27.452: W/dalvikvm(2261): threadid=1: thread exiting with uncaught exception (group=0x415f9560)
11-18 05:05:27.462: E/AndroidRuntime(2261): FATAL EXCEPTION: main
11-18 05:05:27.462: E/AndroidRuntime(2261): Process: com.sns.app, PID: 2261
11-18 05:05:27.462: E/AndroidRuntime(2261): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android10MemoryBaseC1ERKNS_2spINS_11IMemoryHeapEEElj" referenced by "libdatabase_sqlcipher.so"...
11-18 05:05:27.462: E/AndroidRuntime(2261):     at java.lang.Runtime.loadLibrary(Runtime.java:364)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at java.lang.System.loadLibrary(System.java:526)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:143)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:136)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at com.sns.app.activities.LoginActivity.init(LoginActivity.java:78)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at com.sns.app.activities.LoginActivity.onCreate(LoginActivity.java:53)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.app.Activity.performCreate(Activity.java:5231)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.os.Handler.dispatchMessage(Handler.java:102)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.os.Looper.loop(Looper.java:136)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at android.app.ActivityThread.main(ActivityThread.java:5017)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at java.lang.reflect.Method.invokeNative(Native Method)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at java.lang.reflect.Method.invoke(Method.java:515)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-18 05:05:27.462: E/AndroidRuntime(2261):     at dalvik.system.NativeStart.main(Native Method)

#2

Hi @DarkSeeker,

You didn’t mention what version of SQLCipher for Android you are using
below. Based on the dlopen failure, it appears you may be using an
older version of SQLCipher that contained usage of android::MemoryBase
which has been removed from newer versions of Android [1]. Could you
try upgrading to the latest version of SQLCipher for Android and let us
know if this resolves the issue? Thanks!

[1]
https://www.zetetic.net/blog/2013/7/10/sqlcipher-for-android-urgent-upgrade-required.html


#3

That seem to be a problem.By upgrading to SQLCipher version 2.2.1 , the problem resolve by itself.


#4

Hi @DarkSeeker,

I’m glad to hear that resolved your issue. You might consider moving to
the latest version, currently 3.2.0 as it contains many updates since
the 2.2.1 release.


#5

Does the version 3.2.0 have performance improvement? I am having performance issue. And should I use sql cipher counter part for improve performance for example using “net.sqlcipher.database.SQLiteQueryBuilder” instead of “android.database.sqlite.SQLiteQueryBuilder” ?


#6

Hello @DarkSeeker

There are performance improvements based on the changed introduced in SQLite 3.8.6, see here for specifics. With regard to SQLCipher performance, I would recommend reviewing these recommendations in comparison to how your application has integrated the library.


#7

I have a problem with LoadLibs in Android 5.0 Lollipop.
My app crash when trying to load the libs.
I use the latest libs from “https://www.zetetic.net/sqlcipher/sqlcipher-for-android/”.

Any idea why i get this error? Without sqlcipher my database work fine. I saw that guava.jar and common-libs.jar are not included in the last SQLCipher for Android Community Edition binaries.


#8

Hi @galapagosul

We would be glad to help, however we will need more information. What stack trace do you have for the crash? What are you attempting to do when it crashes? guava.jar and commons-codec.jar were removed as dependencies.