0

I'm using sqlcipher and some native code in my app. Everything works good on almost all devices. Problem exists only on Nexus 5X with Android 6.0.1. I get error:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/sqlite.sql3312test-1/base.apk"],nativeLibraryDirectories=[/data/app/sqlite.sql3312test-1/lib/arm64, /data/app/sqlite.sql3312test-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libstlport_shared.so"
                                                                                 at java.lang.Runtime.loadLibrary(Runtime.java:367)

I'm using gradle, I have dependency:

dependencies {
    //..
    compile 'net.zetetic:android-database-sqlcipher:3.3.1-2@aar'
}

Code in my MainActivity:

protected void onCreate(Bundle savedInstanceState) {
    //...
    SQLiteDatabase.loadLibs(this);
}

In local.properties I specified path to my ndk:

ndk.dir=/Users/me/Desktop/ndk/android-ndk-r10e

My gradle.properties:

android.useDeprecatedNdk=true

My project stucture

If I remove jni directory sqlcipher works good. But I need this directory... Can anyone help me?

AdamN
  • 476
  • 5
  • 13
  • What ABIs are you supporting for your own NDK code? Classically, that would be in `Application.mk` in your `jni/` directory. If you are using Gradle's NDK support, that would be in `abiFilter` in the `ndk` closure in the `defaultConfig` closure in the `android` closure in the module's `build.gradle` file. – CommonsWare Apr 01 '16 at 12:18
  • Thank you @CommonWare, I added abiFilters "armeabi-v7a", "armeabi" and now it works great! But can you explain me this situation? Why it only didn't work on Nexus? – AdamN Apr 01 '16 at 13:34
  • Well, since I don't know what you started with, I can't really answer that question. Right now, SQLCipher for Android is not available with 64-bit libraries, only the 32-bit libraries. And, Android wants to load the same CPU architecture libraries for all NDK code. This leads to some problems, when the app's own NDK code (or some other library) wants to use 64-bit libraries. I can't say for certain that is what your problem was, though. – CommonsWare Apr 01 '16 at 14:04

0 Answers0