Hello,
After searching for all the forum and documentation, I am not able to make the new version of SQLCipher work in Android.
I was using successfully a previous version of SQLCipher and I have migrated to 3.3.1-2 because of the issues with Android 6.0. I have erased all the previous files in my project related to SQLcipher, I mean, *.so, ICUDTL, *.jar and then I added in Gradle the compile line:
compile ‘net.zetetic:android-database-sqlcipher:3.3.1-2@aar’
But when I execute my app I get:
11-25 17:39:40.485 7504-7552/? I/Database: sqlite returned: error code = 14, msg = os_unix.c:34892: (2) open(/data/data/com.mydomain/databases/my_database_01) -
11-25 17:39:40.485 7504-7552/? E/Database: sqlite3_open_v2("/data/data/com.mydomain/databases/my_database_01", &handle, 1, NULL) failed
11-25 17:39:40.495 7504-7552/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.mydomain, PID: 7504
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: net.sqlcipher.database.SQLiteException: error code 14: Could not open database
at net.sqlcipher.database.SQLiteDatabase.dbopen(Native Method)
at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2322)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1087)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1028)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:956)
at com.meapp.data.DataBaseHelper.openDataBase(DataBaseHelper.java:189)
at com.meapp.activities.Main_activity.checkUpdate_DB_3(Main_activity.java:307)
at com.meapp.activities.Main_activity.access$1100(Main_activity.java:61)
at com.meapp.activities.Main_activity$ChecksStartUP.doInBackground(Main_activity.java:579)
at com.meapp.activities.Main_activity$ChecksStartUP.doInBackground(Main_activity.java:549)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
11-25 17:39:40.502 868-1626/? D/ActivityManager: New dropbox entry: com.mydomain, data_app_crash, 47367f72-c553-4e8c-a95a-43aa8829a8e2
11-25 17:39:40.503 868-1626/? W/ActivityManager: Force finishing activity 1 com.mydomain/com.meapp.activities.Main_activity
11-25 17:39:41.617 1617-1617/? W/PackageManager: Failure retrieving resources for com.mydomain: Resource ID #0x0
11-25 17:44:40.587 868-2080/? I/ActivityManager: Process com.mydomain (pid 7504) has died
I found that when migrating from a previous version of the library some modificacions must be performed like @developernotes says here File is encrypted or is not a database after upgrade SQLCipher from v.2.2.2.0 to v.3.1.0
So to avoid openning a previous version, I uninstalled my application and make sure that NO ddbb existed when trying to open it, that it was the standard behaviour that worked well previously.
Could you give me some hint about what could be happening?
Thank you very much!!