I have a working Android app that uses the armeabi
libraries for SQLCipher but I cannot make the app work for x86
.
When I try and debug the app on an x86 device I can step through the app until the call to SQLiteDatabase.loadLibs(this);
which results in A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
I've checked the library loading in logcat;
armeabi
D/dalvikvm? Trying to load lib /data/data/com.eglootech.sqlcipher/lib/libstlport_shared.so 0x42562c10
D/dalvikvm? Added shared lib /data/data/com.eglootech.sqlcipher/lib/libstlport_shared.so 0x42562c10
D/dalvikvm? No JNI_OnLoad found in /data/data/com.eglootech.sqlcipher/lib/libstlport_shared.so 0x42562c10, skipping init
D/dalvikvm? Trying to load lib /data/data/com.eglootech.sqlcipher/lib/libsqlcipher_android.so 0x42562c10
D/dalvikvm? Added shared lib /data/data/com.eglootech.sqlcipher/lib/libsqlcipher_android.so 0x42562c10
D/dalvikvm? No JNI_OnLoad found in /data/data/com.eglootech.sqlcipher/lib/libsqlcipher_android.so 0x42562c10, skipping init
D/dalvikvm? Trying to load lib /data/data/com.eglootech.sqlcipher/lib/libdatabase_sqlcipher.so 0x42562c10
D/dalvikvm? Added shared lib /data/data/com.eglootech.sqlcipher/lib/libdatabase_sqlcipher.so 0x42562c10
I/Database? JNI_OnLoad called
I/Database? JNI_OnLoad register methods
x86
D/dalvikvm? Trying to load lib /data/app-lib/com.eglootech.electorlookup-2/libstlport_shared.so 0x41c3e430
D/dalvikvm? Added shared lib /data/app-lib/com.eglootech.electorlookup-2/libstlport_shared.so 0x41c3e430
D/dalvikvm? No JNI_OnLoad found in /data/app-lib/com.eglootech.electorlookup-2/libstlport_shared.so 0x41c3e430, skipping init
D/dalvikvm? Trying to load lib /data/app-lib/com.eglootech.electorlookup-2/libsqlcipher_android.so 0x41c3e430
D/dalvikvm? Added shared lib /data/app-lib/com.eglootech.electorlookup-2/libsqlcipher_android.so 0x41c3e430
D/dalvikvm? No JNI_OnLoad found in /data/app-lib/com.eglootech.electorlookup-2/libsqlcipher_android.so 0x41c3e430, skipping init
D/dalvikvm? Trying to load lib /data/app-lib/com.eglootech.electorlookup-2/libdatabase_sqlcipher.so 0x41c3e430
D/dalvikvm? Added shared lib /data/app-lib/com.eglootech.electorlookup-2/libdatabase_sqlcipher.so 0x41c3e430
A/libc? Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 2313 (h.electorlookup)
Why would the JNI_OnLoad
calls be missing?
I can step into the I can step into the the call to the SQLiteDatabase.loadLibs(this);
and the error comes from SQLiteDatabase
and the call to loadLibs(android.content.Context context, java.io.File workingDir)
where workingDir
is /data/data/com.eglootech.sqlcipher/files
.
I have included both the armeabi
and x86
native libraries in the same way within my Android Studio project;
These are the binaries you download from SQLCipher and then each platform directory is zipped under a lib
folder and then the zip renamed to .jar
. They appear in the list as lib.armeabi
and lib.x86
although they are nested folders within the .jar
.
Then in Gradle I have the following that should make sure the native files are copied across;
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
Is there a reason the native libraries would not be included for x86
?
I have also tried including the libraries not in a .jar
and just in a directory according to; Android studio, gradle and NDK
Again the app works in armeabi
but not x86
.
The app can work on x86
with just the armeabi
libraries but the performance suffers because of the virtualisation and we want to prove with the correct native libraries x86
performs as well if not better.