Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.UnsatisfiedLinkError: dbopen

I am trying to write an Android test case on a block of code in the android application.the block of code will interact with the database (sqlcipher library functions) specifically dbopen() function. When running the application, it is working fine. When we were trying to execute the test case for that block of code(which involves database interaction). It is giving following error: java.lang.UnsatisfiedLinkError: dbopen

Could any look into this and suggest.

Can't a test case has authority to call a function which is calling sqlcipher library functions. Any permissions required, or Any specific procedure is there for this type of test cases ?

complete Error log:

            04-30 12:08:33.997: I/TestRunner(2169): started: teststateMachine(com.americanlogistics.mdd.rhapsody.view.test.SigninViewsateMachineTest)
            04-30 12:08:34.147: W/dalvikvm(2169): No implementation found for native Linfo/guardianproject/database/sqlcipher/SQLiteDatabase;.dbopen (Ljava/lang/String;I)V
            04-30 12:08:34.164: I/TestRunner(2169): failed: teststateMachine(com.americanlogistics.mdd.rhapsody.view.test.SigninViewsateMachineTest)
            04-30 12:08:34.164: I/TestRunner(2169): ----- begin exception -----
            04-30 12:08:34.184: I/TestRunner(2169): java.lang.UnsatisfiedLinkError: dbopen
            04-30 12:08:34.184: I/TestRunner(2169):     at info.guardianproject.database.sqlcipher.SQLiteDatabase.dbopen(Native Method)
            04-30 12:08:34.184: I/TestRunner(2169):     at info.guardianproject.database.sqlcipher.SQLiteDatabase.<init>(SQLiteDatabase.java:1870)
            04-30 12:08:34.184: I/TestRunner(2169):     at info.guardianproject.database.sqlcipher.SQLiteDatabase.openDatabase(SQLiteDatabase.java:863)
            04-30 12:08:34.184: I/TestRunner(2169):     at info.guardianproject.database.sqlcipher.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:897)
            04-30 12:08:34.184: I/TestRunner(2169):     at info.guardianproject.database.sqlcipher.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:107)
            04-30 12:08:34.184: I/TestRunner(2169):     at com.americanlogistics.mdd.rhapsody.database.SendQueueDBAdapter.open(SendQueueDBAdapter.java:45)
            04-30 12:08:34.184: I/TestRunner(2169):     at com.americanlogistics.mdd.rhapsody.database.SendQueueDBAdapter.databaseHelperInstance(SendQueueDBAdapter.java:38)
            04-30 12:08:34.184: I/TestRunner(2169):     at com.americanlogistics.mdd.rhapsody.common.ApplicationController.startDatabase(ApplicationController.java:530)
            04-30 12:08:34.184: I/TestRunner(2169):     at com.americanlogistics.mdd.rhapsody.view.test.SigninViewsateMachineTest.teststateMachine(SigninViewsateMachineTest.java:61)
            04-30 12:08:34.184: I/TestRunner(2169):     at java.lang.reflect.Method.invokeNative(Native Method)
            04-30 12:08:34.184: I/TestRunner(2169):     at java.lang.reflect.Method.invoke(Method.java:507)
            04-30 12:08:34.184: I/TestRunner(2169):     at junit.framework.TestCase.runTest(TestCase.java:154)
            04-30 12:08:34.184: I/TestRunner(2169):     at junit.framework.TestCase.runBare(TestCase.java:127)
            04-30 12:08:34.184: I/TestRunner(2169):     at junit.framework.TestResult$1.protect(TestResult.java:106)
            04-30 12:08:34.184: I/TestRunner(2169):     at junit.framework.TestResult.runProtected(TestResult.java:124)
            04-30 12:08:34.184: I/TestRunner(2169):     at junit.framework.TestResult.run(TestResult.java:109)
            04-30 12:08:34.184: I/TestRunner(2169):     at junit.framework.TestCase.run(TestCase.java:118)
            04-30 12:08:34.184: I/TestRunner(2169):     at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
            04-30 12:08:34.184: I/TestRunner(2169):     at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
            04-30 12:08:34.184: I/TestRunner(2169):     at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
            04-30 12:08:34.184: I/TestRunner(2169):     at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)
            04-30 12:08:34.184: I/TestRunner(2169): ----- end exception -----

Code:

The below line in the test case is indirectly calling sqlcipher library function.

ApplicationController.getInstance().startDatabase(this.getContext().getApplicationContext());

like image 887
candy Avatar asked Apr 30 '12 13:04

candy


2 Answers

I encountered the same error while intergrating SQLCipher for Android. The solution for me was to call

SQLiteDatabase.loadLibs(Context context)

before working with the database itself, as recommended. A good place to call that is in the Application's derived class.

Please see the instructions here

like image 90
ivohad Avatar answered Nov 11 '22 11:11

ivohad


No implementation found for native Linfo/guardianproject/database/sqlcipher/SQLiteDatabase;.dbopen (Ljava/lang/String;I)V

It seems you code is incompatible with version you are running. Make sure they are compatible.

like image 40
kosa Avatar answered Nov 11 '22 12:11

kosa