0

Hi I try to implement sql cipher. I use the code from github from here(https://github.com/sqlcipher/android-database-sqlcipher). Extract the source code and import it into eclipse. But it's not running. I got the following exception . Please anyone tell me what i've done wrong?

FATAL EXCEPTION: main
 java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared: findLibrary returned null
    at java.lang.Runtime.loadLibrary(Runtime.java:365)
    at java.lang.System.loadLibrary(System.java:535)
    at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:120)
    at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:115)
    at example.SQLDemoActivity.onCreate(SQLDemoActivity.java:20)
    at android.app.Activity.performCreate(Activity.java:5020)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
    at android.app.ActivityThread.access$600(ActivityThread.java:149)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:153)
    at android.app.ActivityThread.main(ActivityThread.java:4987)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
    at dalvik.system.NativeStart.main(Native Method)
Amsheer
  • 7,046
  • 8
  • 47
  • 81

3 Answers3

0

Your project is not properly including the native .so files with your application. These are required for SQLCipher for Android to operate. They should be in a platform specific folder beneath the libs folder. As a reference, please review the project structure of the SQLCipher for Android test suite.

Nick Parker
  • 1,378
  • 1
  • 7
  • 10
0

I found the solution: Initially i forgot to add armeabi, armeabi-v7a, x86 folders. Which contains .so files.

In armeabi:

libdatabase_sqlcipher.so
libsqlcipher_android.so
libstlport_shared.so

In armeabi-v7a:

libdatabase_sqlcipher.so
libsqlcipher_android.so
libstlport_shared.so

In x86:

libdatabase_sqlcipher.so
libsqlcipher_android.so
libstlport_shared.so

I've add armeabi, armeabi-v7a,x86. folders in libs now it works.

Amsheer
  • 7,046
  • 8
  • 47
  • 81
0

You don't need to download a .zip package and copy-paste libs no more. Just add a Gradle dependency, like compile 'net.zetetic:android-database-sqlcipher:3.3.1-2@aar'. Here you can always check the latest version.

lomza
  • 9,412
  • 15
  • 70
  • 85