I am facing an issue while running the junit test cases in android studio. The issue is very strange as when I run the test cases for the first time in the phone it works perfectly fine, but if the app is already installed and when I run the test cases I get following error:-
net.sqlcipher.database.SQLiteException: not an error
at net.sqlcipher.database.SQLiteDatabase.dbopen(Native Method)
at net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:1942)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:875)
at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:907)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:132)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:99)
All the sqlcipher dependencies are correctly configured.
I found the solution for this issue. When I saw in the logs, I found that the actual issue was
It was happening because i was not calling the
loadlibs
ofSQLiteCipher
inside the test suites.So I added the following line in
setup()
method of my test class