SQLCipher Integration with Android Cordova App


#1

Hi,

I am trying to integrate SQLCipher in an Android Cordova App. I followed the tutorial and used the binaries offered there (SQLCipher for Android v 3.1.0). I copied the libs and assets into my project but there are still errors which leads into crashing the app.
On the one hand i am getting the unsatisfied link error and on the other hand i am getting no implementation found for native … dbopen.
I already compared my project structure to the android test suite given here.
To understand the problem better i append the error log:


V/info ( 551): Open sqlite db: /data/data/com.example.app/databases/DB
D/CordovaLog( 551): file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js: Line 39 : SQLitePlugin openargs: {“name”:“DB”,“password”:“secret2”}
I/chromium( 551): [INFO:CONSOLE(39)] “SQLitePlugin openargs: {“name”:“DB”,“password”:“secret2”}”, source: file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js (39)
D/CordovaLog( 551): file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js: Line 115 : {“name”:“DB”,“password”:“secret2”}
I/chromium( 551): [INFO:CONSOLE(115)] “{“name”:“DB”,“password”:“secret2”}”, source: file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js (115)
W/dalvikvm( 551): No implementation found for native Lnet/sqlcipher/database/SQLiteDatabase;.dbopen:(Ljava/lang/String;I)V
W/dalvikvm( 551): threadid=22: thread exiting with uncaught exception (group=0x41786da0)
I/App ( 551): WARNING: Back Button Default Behavior will be overridden. The backbutton event will be fired!
E/AndroidRuntime( 551): FATAL EXCEPTION: pool-1-thread-1
E/AndroidRuntime( 551): Process: com.example.app, PID: 551
E/AndroidRuntime( 551): java.lang.UnsatisfiedLinkError: Native method not found: net.sqlcipher.database.SQLiteDatabase.dbopen:(Ljava/lang/String;I)V
E/AndroidRuntime( 551): at net.sqlcipher.database.SQLiteDatabase.dbopen(Native Method)
E/AndroidRuntime( 551): at net.sqlcipher.database.SQLiteDatabase.(SQLiteDatabase.java:1950)
E/AndroidRuntime( 551): at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:900)
E/AndroidRuntime( 551): at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:928)
E/AndroidRuntime( 551): at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:935)
E/AndroidRuntime( 551): at org.pgsqlite.SQLitePlugin.openDatabase(SQLitePlugin.java:245)
E/AndroidRuntime( 551): at org.pgsqlite.SQLitePlugin.access$000(SQLitePlugin.java:34)
E/AndroidRuntime( 551): at org.pgsqlite.SQLitePlugin$DBRunner.run(SQLitePlugin.java:792)
E/AndroidRuntime( 551): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime( 551): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime( 551): at java.lang.Thread.run(Thread.java:841)
W/ActivityManager( 752): Force finishing activity com.example.app/.App


#2

Hi @mmaier

It definitely sounds as if the native libraries are not being packaged properly within your application project. Could you take a screenshot of the project layout and show us your current setup?