0
votes

I'm trying to use the SQLCipher library but always get the same error. I have a very small class to test the library:

import android.database.Cursor;

// Uncomment to use sqlite
//import android.database.sqlite.SQLiteDatabase;
//import android.database.sqlite.SQLiteOpenHelper;

// Uncomment to use sqlcipher
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;

import android.content.ContentValues;
import android.content.Context;
import android.util.Log; 

public class DataHandler extends SQLiteOpenHelper {

  SQLiteDatabase db;
  String dbPassword;  

  static final String dbName = "demo.db";
  static final String defualtDbPassword = "password";  
  static final boolean ENCRYPT_DATA = false;
  static final int dbVersion = 1;

  public DataHandler(Context context){
    this(context, defualtDbPassword);
  }

  public Z41DataHandler(Context context, String password){
    super(context, dbName, null, dbVersion);

    dbPassword = password;

    // Uncomment to use sqlite
//  db = getWritableDatabase();

    // Uncomment to use sqlcipher   
    SQLiteDatabase.loadLibs(context);
    db = getWritableDatabase(dbPassword);
  }

...
...    
Other methods to perform queries to the database
...
...    

}

As you can see, the code is prepare to work with the standard SQLite library and with SQLCipher, depending on what lines are commented.

When I test the class with SQLite, it works properly in the emulator: the database is created and I can perform INSERT, UPDATE or SELECT operations.

The problem appears when I try to use the SQLCipher library. Before I try any operation, I get the following error:

06-18 07:39:16.684: W/com.example.primerapruebadeandroid.MainActivity(2359): Starting the app
06-18 07:39:16.704: D/dalvikvm(2359): Trying to load lib /data/app-lib/com.example.primerapruebadeandroid-2/libstlport_shared.so 0xb2d93620
06-18 07:39:16.704: W/linker(2359): libstlport_shared.so has text relocations. This is wasting memory and is a security risk. Please fix.
06-18 07:39:16.714: D/dalvikvm(2359): Added shared lib /data/app-lib/com.example.primerapruebadeandroid-2/libstlport_shared.so 0xb2d93620
06-18 07:39:16.714: D/dalvikvm(2359): No JNI_OnLoad found in /data/app-lib/com.example.primerapruebadeandroid-2/libstlport_shared.so 0xb2d93620, skipping init
06-18 07:39:16.714: D/dalvikvm(2359): Trying to load lib /data/app-lib/com.example.primerapruebadeandroid-2/libsqlcipher_android.so 0xb2d93620
06-18 07:39:16.734: W/linker(2359): libsqlcipher_android.so has text relocations. This is wasting memory and is a security risk. Please fix.
06-18 07:39:16.744: D/dalvikvm(2359): Added shared lib /data/app-lib/com.example.primerapruebadeandroid-2/libsqlcipher_android.so 0xb2d93620
06-18 07:39:16.744: D/dalvikvm(2359): No JNI_OnLoad found in /data/app-lib/com.example.primerapruebadeandroid-2/libsqlcipher_android.so 0xb2d93620, skipping init
06-18 07:39:16.744: D/dalvikvm(2359): Trying to load lib /data/app-lib/com.example.primerapruebadeandroid-2/libdatabase_sqlcipher.so 0xb2d93620
06-18 07:39:16.744: W/linker(2359): libdatabase_sqlcipher.so has text relocations. This is wasting memory and is a security risk. Please fix.
06-18 07:39:16.754: D/dalvikvm(2359): Added shared lib /data/app-lib/com.example.primerapruebadeandroid-2/libdatabase_sqlcipher.so 0xb2d93620
06-18 07:39:16.754: I/Database(2359): JNI_OnLoad called
06-18 07:39:16.764: I/Database(2359): JNI_OnLoad register methods 
06-18 07:39:16.764: E/dalvikvm(2359): ERROR: couldn't find native method
06-18 07:39:16.764: E/dalvikvm(2359): Requested: Lnet/sqlcipher/database/SQLiteDatabase;.native_key:([C)V
06-18 07:39:16.764: W/dalvikvm(2359): JNI WARNING: JNI function FatalError called with exception pending
06-18 07:39:16.764: W/dalvikvm(2359):              in Ljava/lang/Runtime;.nativeLoad:(Ljava/lang/String;Ljava/lang/ClassLoader;Ljava/lang/String;)Ljava/lang/String; (FatalError)
06-18 07:39:16.764: W/dalvikvm(2359): Pending exception is:
06-18 07:39:16.764: I/dalvikvm(2359): java.lang.NoSuchMethodError: no static or non-static method "Lnet/sqlcipher/database/SQLiteDatabase;.native_key([C)V"
06-18 07:39:16.764: I/dalvikvm(2359):   at java.lang.Runtime.nativeLoad(Native Method)
06-18 07:39:16.764: I/dalvikvm(2359):   at java.lang.Runtime.doLoad(Runtime.java:421)
06-18 07:39:16.764: I/dalvikvm(2359):   at java.lang.Runtime.loadLibrary(Runtime.java:362)
06-18 07:39:16.764: I/dalvikvm(2359):   at java.lang.System.loadLibrary(System.java:526)
06-18 07:39:16.764: I/dalvikvm(2359):   at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:143)
06-18 07:39:16.764: I/dalvikvm(2359):   at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:136)
06-18 07:39:16.764: I/dalvikvm(2359):   at com.example.primerapruebadeandroid.Persistence.DataHandler.<init>(DataHandler.java:80)
06-18 07:39:16.764: I/dalvikvm(2359):   at com.example.primerapruebadeandroid.Persistence.DataHandler.<init>(DataHandler.java:64)
06-18 07:39:16.764: I/dalvikvm(2359):   at com.example.primerapruebadeandroid.MainActivity.onCreate(MainActivity.java:37)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.app.Activity.performCreate(Activity.java:5231)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.os.Handler.dispatchMessage(Handler.java:102)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.os.Looper.loop(Looper.java:136)
06-18 07:39:16.764: I/dalvikvm(2359):   at android.app.ActivityThread.main(ActivityThread.java:5017)
06-18 07:39:16.764: I/dalvikvm(2359):   at java.lang.reflect.Method.invokeNative(Native Method)
06-18 07:39:16.764: I/dalvikvm(2359):   at java.lang.reflect.Method.invoke(Method.java:515)
06-18 07:39:16.764: I/dalvikvm(2359):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-18 07:39:16.764: I/dalvikvm(2359):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-18 07:39:16.764: I/dalvikvm(2359):   at dalvik.system.NativeStart.main(Native Method)
06-18 07:39:16.764: I/dalvikvm(2359): "main" prio=5 tid=1 NATIVE
06-18 07:39:16.764: I/dalvikvm(2359):   | group="main" sCount=0 dsCount=0 obj=0xb2ae0ca8 self=0xb88e1398
06-18 07:39:16.764: I/dalvikvm(2359):   | sysTid=2359 nice=0 sched=0/0 cgrp=apps handle=-1224953516
06-18 07:39:16.764: I/dalvikvm(2359):   | state=R schedstat=( 320000000 750000000 117 ) utm=20 stm=12 core=0
06-18 07:39:16.844: I/dalvikvm(2359):   #00  pc 0000132e  /system/lib/libcorkscrew.so (unwind_backtrace_thread+29)
06-18 07:39:16.844: I/dalvikvm(2359):   #01  pc 000603ea  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+33)
06-18 07:39:16.844: I/dalvikvm(2359):   #02  pc 000543e4  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+395)
06-18 07:39:16.844: I/dalvikvm(2359):   #03  pc 00054452  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
06-18 07:39:16.854: I/dalvikvm(2359):   #04  pc 0003871c  /system/lib/libdvm.so
06-18 07:39:16.854: I/dalvikvm(2359):   #05  pc 00041212  /system/lib/libdvm.so
06-18 07:39:16.854: I/dalvikvm(2359):   #06  pc 00001fd2  /system/lib/libnativehelper.so (jniRegisterNativeMethods+81)
06-18 07:39:16.854: I/dalvikvm(2359):   #07  pc 00005ba0  /data/app-lib/com.example.primerapruebadeandroid-2/libdatabase_sqlcipher.so (sqlcipher::register_android_database_SQLiteDatabase(_JNIEnv*)+59)
06-18 07:39:16.854: I/dalvikvm(2359):   #08  pc 00005c28  /data/app-lib/com.example.primerapruebadeandroid-2/libdatabase_sqlcipher.so (JNI_OnLoad+51)
06-18 07:39:16.854: I/dalvikvm(2359):   #09  pc 0004fde2  /system/lib/libdvm.so (dvmLoadNativeCode(char const*, Object*, char**)+465)
06-18 07:39:16.854: I/dalvikvm(2359):   #10  pc 0006746c  /system/lib/libdvm.so
06-18 07:39:16.854: I/dalvikvm(2359):   #11  pc 00026fe0  /system/lib/libdvm.so
06-18 07:39:16.854: I/dalvikvm(2359):   #12  pc 0002df34  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
06-18 07:39:16.854: I/dalvikvm(2359):   #13  pc 0002b5cc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
06-18 07:39:16.854: I/dalvikvm(2359):   #14  pc 000605fc  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+391)
06-18 07:39:16.854: I/dalvikvm(2359):   #15  pc 000684c6  /system/lib/libdvm.so
06-18 07:39:16.854: I/dalvikvm(2359):   #16  pc 00026fe0  /system/lib/libdvm.so
06-18 07:39:16.854: I/dalvikvm(2359):   #17  pc 0002df34  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
06-18 07:39:16.854: I/dalvikvm(2359):   #18  pc 0002b5cc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
06-18 07:39:16.854: I/dalvikvm(2359):   #19  pc 00060318  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+335)
06-18 07:39:16.864: I/dalvikvm(2359):   #20  pc 00049b4e  /system/lib/libdvm.so
06-18 07:39:16.864: I/dalvikvm(2359):   #21  pc 0003cd02  /system/lib/libdvm.so
06-18 07:39:16.864: I/dalvikvm(2359):   #22  pc 0004cddc  /system/lib/libandroid_runtime.so
06-18 07:39:16.864: I/dalvikvm(2359):   #23  pc 0004dad6  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+353)
06-18 07:39:16.864: I/dalvikvm(2359):   #24  pc 0000105a  /system/bin/app_process
06-18 07:39:16.864: I/dalvikvm(2359):   #25  pc 0000e238  /system/lib/libc.so (__libc_init+47)
06-18 07:39:16.864: I/dalvikvm(2359):   at java.lang.Runtime.nativeLoad(Native Method)
06-18 07:39:16.864: I/dalvikvm(2359):   at java.lang.Runtime.doLoad(Runtime.java:421)
06-18 07:39:16.864: I/dalvikvm(2359):   at java.lang.Runtime.loadLibrary(Runtime.java:362)
06-18 07:39:16.864: I/dalvikvm(2359):   at java.lang.System.loadLibrary(System.java:526)
06-18 07:39:16.864: I/dalvikvm(2359):   at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:143)
06-18 07:39:16.864: I/dalvikvm(2359):   at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:136)
06-18 07:39:16.864: I/dalvikvm(2359):   at com.example.primerapruebadeandroid.Persistence.DataHandler.<init>(DataHandler.java:80)
06-18 07:39:16.864: I/dalvikvm(2359):   at com.example.primerapruebadeandroid.Persistence.DataHandler.<init>(DataHandler.java:64)
06-18 07:39:16.864: I/dalvikvm(2359):   at com.example.primerapruebadeandroid.MainActivity.onCreate(MainActivity.java:37)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.app.Activity.performCreate(Activity.java:5231)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.os.Handler.dispatchMessage(Handler.java:102)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.os.Looper.loop(Looper.java:136)
06-18 07:39:16.864: I/dalvikvm(2359):   at android.app.ActivityThread.main(ActivityThread.java:5017)
06-18 07:39:16.864: I/dalvikvm(2359):   at java.lang.reflect.Method.invokeNative(Native Method)
06-18 07:39:16.864: I/dalvikvm(2359):   at java.lang.reflect.Method.invoke(Method.java:515)
06-18 07:39:16.864: I/dalvikvm(2359):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-18 07:39:16.864: I/dalvikvm(2359):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-18 07:39:16.864: I/dalvikvm(2359):   at dalvik.system.NativeStart.main(Native Method)
06-18 07:39:16.864: E/dalvikvm(2359): VM aborting
06-18 07:39:16.864: A/libc(2359): Fatal signal 6 (SIGABRT) at 0x00000937 (code=-6), thread 2359 (pruebadeandroid)
06-18 07:51:37.464: W/com.example.primerapruebadeandroid.MainActivity(2408): Starting the app
06-18 07:51:37.474: D/dalvikvm(2408): Trying to load lib /data/app-lib/com.example.primerapruebadeandroid-1/libstlport_shared.so 0xb2d945b0
06-18 07:51:37.474: W/linker(2408): libstlport_shared.so has text relocations. This is wasting memory and is a security risk. Please fix.
06-18 07:51:37.484: D/dalvikvm(2408): Added shared lib /data/app-lib/com.example.primerapruebadeandroid-1/libstlport_shared.so 0xb2d945b0
06-18 07:51:37.484: D/dalvikvm(2408): No JNI_OnLoad found in /data/app-lib/com.example.primerapruebadeandroid-1/libstlport_shared.so 0xb2d945b0, skipping init
06-18 07:51:37.484: D/dalvikvm(2408): Trying to load lib /data/app-lib/com.example.primerapruebadeandroid-1/libsqlcipher_android.so 0xb2d945b0
06-18 07:51:37.494: W/linker(2408): libsqlcipher_android.so has text relocations. This is wasting memory and is a security risk. Please fix.
06-18 07:51:37.504: D/dalvikvm(2408): Added shared lib /data/app-lib/com.example.primerapruebadeandroid-1/libsqlcipher_android.so 0xb2d945b0
06-18 07:51:37.504: D/dalvikvm(2408): No JNI_OnLoad found in /data/app-lib/com.example.primerapruebadeandroid-1/libsqlcipher_android.so 0xb2d945b0, skipping init
06-18 07:51:37.514: D/dalvikvm(2408): Trying to load lib /data/app-lib/com.example.primerapruebadeandroid-1/libdatabase_sqlcipher.so 0xb2d945b0
06-18 07:51:37.514: W/linker(2408): libdatabase_sqlcipher.so has text relocations. This is wasting memory and is a security risk. Please fix.
06-18 07:51:37.524: D/dalvikvm(2408): Added shared lib /data/app-lib/com.example.primerapruebadeandroid-1/libdatabase_sqlcipher.so 0xb2d945b0
06-18 07:51:37.524: I/Database(2408): JNI_OnLoad called
06-18 07:51:37.524: I/Database(2408): JNI_OnLoad register methods 
06-18 07:51:37.534: E/dalvikvm(2408): ERROR: couldn't find native method
06-18 07:51:37.534: E/dalvikvm(2408): Requested: Lnet/sqlcipher/database/SQLiteDatabase;.native_key:([C)V
06-18 07:51:37.534: W/dalvikvm(2408): JNI WARNING: JNI function FatalError called with exception pending
06-18 07:51:37.534: W/dalvikvm(2408):              in Ljava/lang/Runtime;.nativeLoad:(Ljava/lang/String;Ljava/lang/ClassLoader;Ljava/lang/String;)Ljava/lang/String; (FatalError)
06-18 07:51:37.534: W/dalvikvm(2408): Pending exception is:
06-18 07:51:37.534: I/dalvikvm(2408): java.lang.NoSuchMethodError: no static or non-static method "Lnet/sqlcipher/database/SQLiteDatabase;.native_key([C)V"
06-18 07:51:37.534: I/dalvikvm(2408):   at java.lang.Runtime.nativeLoad(Native Method)
06-18 07:51:37.534: I/dalvikvm(2408):   at java.lang.Runtime.doLoad(Runtime.java:421)
06-18 07:51:37.534: I/dalvikvm(2408):   at java.lang.Runtime.loadLibrary(Runtime.java:362)
06-18 07:51:37.534: I/dalvikvm(2408):   at java.lang.System.loadLibrary(System.java:526)
06-18 07:51:37.534: I/dalvikvm(2408):   at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:143)
06-18 07:51:37.534: I/dalvikvm(2408):   at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:136)
06-18 07:51:37.534: I/dalvikvm(2408):   at com.example.primerapruebadeandroid.Persistence.DataHandler.<init>(DataHandler.java:82)
06-18 07:51:37.534: I/dalvikvm(2408):   at com.example.primerapruebadeandroid.Persistence.DataHandler.<init>(DataHandler.java:66)
06-18 07:51:37.534: I/dalvikvm(2408):   at com.example.primerapruebadeandroid.MainActivity.onCreate(MainActivity.java:37)
06-18 07:51:37.534: I/dalvikvm(2408):   at android.app.Activity.performCreate(Activity.java:5231)
06-18 07:51:37.534: I/dalvikvm(2408):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-18 07:51:37.534: I/dalvikvm(2408):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
06-18 07:51:37.544: I/dalvikvm(2408):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-18 07:51:37.544: I/dalvikvm(2408):   at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-18 07:51:37.544: I/dalvikvm(2408):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-18 07:51:37.544: I/dalvikvm(2408):   at android.os.Handler.dispatchMessage(Handler.java:102)
06-18 07:51:37.544: I/dalvikvm(2408):   at android.os.Looper.loop(Looper.java:136)
06-18 07:51:37.544: I/dalvikvm(2408):   at android.app.ActivityThread.main(ActivityThread.java:5017)
06-18 07:51:37.544: I/dalvikvm(2408):   at java.lang.reflect.Method.invokeNative(Native Method)
06-18 07:51:37.544: I/dalvikvm(2408):   at java.lang.reflect.Method.invoke(Method.java:515)
06-18 07:51:37.544: I/dalvikvm(2408):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-18 07:51:37.544: I/dalvikvm(2408):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-18 07:51:37.544: I/dalvikvm(2408):   at dalvik.system.NativeStart.main(Native Method)
06-18 07:51:37.544: I/dalvikvm(2408): "main" prio=5 tid=1 NATIVE
06-18 07:51:37.544: I/dalvikvm(2408):   | group="main" sCount=0 dsCount=0 obj=0xb2ae0ca8 self=0xb88e1398
06-18 07:51:37.544: I/dalvikvm(2408):   | sysTid=2408 nice=0 sched=0/0 cgrp=apps handle=-1224953516
06-18 07:51:37.544: I/dalvikvm(2408):   | state=R schedstat=( 290000000 560000000 132 ) utm=21 stm=8 core=0
06-18 07:51:37.594: I/dalvikvm(2408):   #00  pc 0000132e  /system/lib/libcorkscrew.so (unwind_backtrace_thread+29)
06-18 07:51:37.594: I/dalvikvm(2408):   #01  pc 000603ea  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+33)
06-18 07:51:37.594: I/dalvikvm(2408):   #02  pc 000543e4  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+395)
06-18 07:51:37.594: I/dalvikvm(2408):   #03  pc 00054452  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
06-18 07:51:37.604: I/dalvikvm(2408):   #04  pc 0003871c  /system/lib/libdvm.so
06-18 07:51:37.604: I/dalvikvm(2408):   #05  pc 00041212  /system/lib/libdvm.so
06-18 07:51:37.604: I/dalvikvm(2408):   #06  pc 00001fd2  /system/lib/libnativehelper.so (jniRegisterNativeMethods+81)
06-18 07:51:37.604: I/dalvikvm(2408):   #07  pc 00005ba0  /data/app-lib/com.example.primerapruebadeandroid-1/libdatabase_sqlcipher.so (sqlcipher::register_android_database_SQLiteDatabase(_JNIEnv*)+59)
06-18 07:51:37.604: I/dalvikvm(2408):   #08  pc 00005c28  /data/app-lib/com.example.primerapruebadeandroid-1/libdatabase_sqlcipher.so (JNI_OnLoad+51)
06-18 07:51:37.604: I/dalvikvm(2408):   #09  pc 0004fde2  /system/lib/libdvm.so (dvmLoadNativeCode(char const*, Object*, char**)+465)
06-18 07:51:37.604: I/dalvikvm(2408):   #10  pc 0006746c  /system/lib/libdvm.so
06-18 07:51:37.604: I/dalvikvm(2408):   #11  pc 00026fe0  /system/lib/libdvm.so
06-18 07:51:37.604: I/dalvikvm(2408):   #12  pc 0002df34  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
06-18 07:51:37.604: I/dalvikvm(2408):   #13  pc 0002b5cc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
06-18 07:51:37.604: I/dalvikvm(2408):   #14  pc 000605fc  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+391)
06-18 07:51:37.604: I/dalvikvm(2408):   #15  pc 000684c6  /system/lib/libdvm.so
06-18 07:51:37.604: I/dalvikvm(2408):   #16  pc 00026fe0  /system/lib/libdvm.so
06-18 07:51:37.604: I/dalvikvm(2408):   #17  pc 0002df34  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
06-18 07:51:37.604: I/dalvikvm(2408):   #18  pc 0002b5cc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
06-18 07:51:37.604: I/dalvikvm(2408):   #19  pc 00060318  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+335)
06-18 07:51:37.604: I/dalvikvm(2408):   #20  pc 00049b4e  /system/lib/libdvm.so
06-18 07:51:37.604: I/dalvikvm(2408):   #21  pc 0003cd02  /system/lib/libdvm.so
06-18 07:51:37.604: I/dalvikvm(2408):   #22  pc 0004cddc  /system/lib/libandroid_runtime.so
06-18 07:51:37.604: I/dalvikvm(2408):   #23  pc 0004dad6  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+353)
06-18 07:51:37.604: I/dalvikvm(2408):   #24  pc 0000105a  /system/bin/app_process
06-18 07:51:37.614: I/dalvikvm(2408):   #25  pc 0000e238  /system/lib/libc.so (__libc_init+47)
06-18 07:51:37.614: I/dalvikvm(2408):   at java.lang.Runtime.nativeLoad(Native Method)
06-18 07:51:37.614: I/dalvikvm(2408):   at java.lang.Runtime.doLoad(Runtime.java:421)
06-18 07:51:37.614: I/dalvikvm(2408):   at java.lang.Runtime.loadLibrary(Runtime.java:362)
06-18 07:51:37.614: I/dalvikvm(2408):   at java.lang.System.loadLibrary(System.java:526)
06-18 07:51:37.614: I/dalvikvm(2408):   at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:143)
06-18 07:51:37.614: I/dalvikvm(2408):   at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:136)
06-18 07:51:37.614: I/dalvikvm(2408):   at com.example.primerapruebadeandroid.Persistence.DataHandler.<init>(DataHandler.java:82)
06-18 07:51:37.614: I/dalvikvm(2408):   at com.example.primerapruebadeandroid.Persistence.DataHandler.<init>(DataHandler.java:66)
06-18 07:51:37.614: I/dalvikvm(2408):   at com.example.primerapruebadeandroid.MainActivity.onCreate(MainActivity.java:37)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.app.Activity.performCreate(Activity.java:5231)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.os.Handler.dispatchMessage(Handler.java:102)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.os.Looper.loop(Looper.java:136)
06-18 07:51:37.614: I/dalvikvm(2408):   at android.app.ActivityThread.main(ActivityThread.java:5017)
06-18 07:51:37.614: I/dalvikvm(2408):   at java.lang.reflect.Method.invokeNative(Native Method)
06-18 07:51:37.624: I/dalvikvm(2408):   at java.lang.reflect.Method.invoke(Method.java:515)
06-18 07:51:37.624: I/dalvikvm(2408):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-18 07:51:37.624: I/dalvikvm(2408):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-18 07:51:37.624: I/dalvikvm(2408):   at dalvik.system.NativeStart.main(Native Method)
06-18 07:51:37.624: E/dalvikvm(2408): VM aborting
06-18 07:51:37.624: A/libc(2408): Fatal signal 6 (SIGABRT) at 0x00000968 (code=-6), thread 2408 (pruebadeandroid)

I have tried to execute this test using the SQLCipher versions 3.1 (last available binaries for android), 2.2.2 and 2.1.1, and get always the same result. I cannot test it on a real device because the lack of it.

I have followed the instruction to include the library in my project: copy the content of the libs and assets folder and include the libraries in the build path:

If I open the adb terminal and I move to the application folder, I can see the lib folder with libdatabase_sqlcipher.so, libsqlcipher_android.so and libstlport_shared.so

By the way, I'm using the ADT v22.6.2-1085508 for mac.

Any idea about what could be happening?

1
It sounds like a project configuration issue, could you try running the SQLCipher for Android test suite here. You may wish to move this question over to the SQLCipher mailing list here as well. - Nick Parker
Hi @NickParker, I have requested to join the group to ask the question there. Meanwhile, I'm trying to run the SQLCipher for Android test suite, but I'm not able to do it. How can I import that project in Eclipse ADT? How can I config the project? I've follow all the instruction in the SQLCipher website. Do you know where can I download an Eclipse project to compare the project configuration? Thank you - jmatamoros
The SQLCipher for Android test suite is setup for IntelliJ, although you could import the project within Eclipse as a Maven project as well. - Nick Parker

1 Answers

1
votes

I encountered an issue similar to this on Android Studio. Turns out I was missing the "jnilibs" folder in my "main" directory.

Example of the Directory Structure

Once added, do a build clean and try run the project again.