SQLCipher issue with libstlport_shared.so


#1

Hi everyone, trying to use sqlcipher with my own application that also uses bunch of JNI C++ modules.

If I try to include sqlcipher 3.4:
compile 'net.zetetic:android-database-sqlcipher:3.4.0@aar’
I would get a compile time error
Error:Execution failed for task ‘:TCSConnect:transformNativeLibsWithMergeJniLibsForVerizonDebug’.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi-v7a/libstlport_shared.so
File1: /Users/al.android/build-cache/df6cf1dbd76e317ff07900b78cc9d4d0292eeca9/output/jni
File2: /Users/al/github/LocationAgent-Android/locationtoolkit/build/intermediates/bundles/default/jni

Looks like 3.4 includes libstlport_shared.so already.

If I were to include 3.5.7 I would get run time error while loading my own libstlport_shared.so

    System.loadLibrary("stlport_shared");

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.tcs.flaprice.hybrid.ui.android-1/base.apk”],nativeLibraryDirectories=[/data/app/com.tcs.flaprice.hybrid.ui.android-1/lib/arm64, /data/app/com.tcs.flaprice.hybrid.ui.android-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn’t find "libstlport_shared.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:972)
at java.lang.System.loadLibrary(System.java:1567)

Any ideas on how to get out of this .so (dll) hell?


#2

I’m going to answer my own question here since I have found a workaround.
Since I only have 32 bit .so native library, I want to eliminate 64 bit libraries from being used.
Adding filter to build script solved my issue.

android {

defaultConfig {

ndk {
abiFilters “armeabi-v7a”
}
}
}


#3

Hello @Alemiser

We are happy to hear you were able to resolve your issue. In the newer version of SQLCipher for Android we include the static version of stlport when linking the library.