sqlcipher / android-database-sqlcipher

Android SQLite API based on SQLCipher
https://www.zetetic.net/sqlcipher/sqlcipher-for-android/
Other
2.73k stars 564 forks source link

SQLCipher Fatal Exception on Android 4.0 #36

Closed inuwan closed 12 years ago

inuwan commented 12 years ago

Running on a Galaxy Nexus phone with Android 4.0. (Works find on 2.2 and 2.3.) The following exception is raised when calling getReadableDatabase().

12-15 16:47:27.819: ERROR/AndroidRuntime(28459): FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{xyz.activity.SplashActivity}: info.guardianproject.database.sqlcipher.SQLiteException: not an error at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) at android.app.ActivityThread.access$600(ActivityThread.java:122) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4340) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: info.guardianproject.database.sqlcipher.SQLiteException: not an error at info.guardianproject.database.sqlcipher.SQLiteDatabase.dbopen(Native Method) at info.guardianproject.database.sqlcipher.SQLiteDatabase.(SQLiteDatabase.java:1870) at info.guardianproject.database.sqlcipher.SQLiteDatabase.openDatabase(SQLiteDatabase.java:863) at info.guardianproject.database.sqlcipher.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:183)

developernotes commented 12 years ago

Hello inuwan,

We are looking into a fix for Android 4.0. Thanks.

developernotes commented 12 years ago

Hello inuwan,

We have put together a branch that includes our work to support Android 4.0, would you be willing to try it out? If so, you can find the repository below:

https://github.com/developernotes/android-database-sqlcipher/tree/icu46

inuwan commented 12 years ago

Tried it and got the following exception calling getReadableDatabase():

01-04 23:54:41.767: ERROR/CMC/DataProvider(451): Exception on getting readable DB info.guardianproject.database.sqlcipher.SQLiteException: not an error at info.guardianproject.database.sqlcipher.SQLiteDatabase.dbopen(Native Method) at info.guardianproject.database.sqlcipher.SQLiteDatabase.(SQLiteDatabase.java:1870) at info.guardianproject.database.sqlcipher.SQLiteDatabase.openDatabase(SQLiteDatabase.java:863) at info.guardianproject.database.sqlcipher.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:183)

01-04 23:54:41.767: ERROR/CMC/DataProvider(451): info.guardianproject.database.sqlcipher.SQLiteDatabase.dbopen(Native Method) 01-04 23:54:41.767: ERROR/CMC/DataProvider(451): info.guardianproject.database.sqlcipher.SQLiteDatabase.(SQLiteDatabase.java:1870) 01-04 23:54:41.777: ERROR/CMC/DataProvider(451): info.guardianproject.database.sqlcipher.SQLiteDatabase.openDatabase(SQLiteDatabase.java:863) 01-04 23:54:41.777: ERROR/CMC/DataProvider(451): info.guardianproject.database.sqlcipher.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:183)

developernotes commented 12 years ago

Hello inuwan,

Can you verify you were building the source from the icu46 branch? Also, you will need to package the new icudt46l.zip file located in the assets directory into your applications assets directory instead of the old icudt44l.zip as the localization library needed to be upgraded for Android 4.0. You should be able to get the binaries out of the libs directory once the build is complete.

inuwan commented 12 years ago

Not having any luck. I download the zip, did a build using IntelliJ - the puts the output in out\production\Developernotes-android-database-sqlcipher-88ab69c\classes.jar - renamed that sqlcipher.jar. Coped the icudt46L.zip file to my assets folder (previously I was not using icudt44l.zip).

It may be easier if you just send me the sqlcipher.jar file in case I'm not building it correctly

-----Original Message----- From: Nick Parker [mailto:reply@reply.github.com] Sent: Friday, January 06, 2012 9:05 AM To: Mori, Ken Subject: Re: [android-database-sqlcipher] SQLCipher Fatal Exception on Android 4.0 (#36)

Hello inuwan,

Can you verify you were building the source from the icu46 branch? Also, you will need to package the new icudt46l.zip file located in the assets directory into your applications assets directory instead of the old icudt44l.zip as the localization library needed to be upgraded for Android 4.0. You should be able to get the binaries out of the libs directory once the build is complete.


Reply to this email directly or view it on GitHub: https://github.com/guardianproject/android-database-sqlcipher/issues/36#issuecomment-3387380

developernotes commented 12 years ago

Hi inuwan,

I can send you the files in a zip, what email address can I use to send them? I do not see one listed in your GitHub profile.

dorotn commented 12 years ago

hi developernotes,

I have the same problem as inuwan... can you send also to me the sqlcipher.jar? Thanks

inuwan commented 12 years ago

ken_mori@intuit.com

Also, I previously was not using icudt44l.zip. Do I need to add the icudt46L.zip? What is it for?

-----Original Message----- From: Nick Parker [mailto:reply@reply.github.com] Sent: Monday, January 09, 2012 5:46 AM To: Mori, Ken Subject: Re: [android-database-sqlcipher] SQLCipher Fatal Exception on Android 4.0 (#36)

Hi inuwan,

I can send you the files in a zip, what email address can I use to send them? I do not see one listed in your GitHub profile.


Reply to this email directly or view it on GitHub: https://github.com/guardianproject/android-database-sqlcipher/issues/36#issuecomment-3411604

developernotes commented 12 years ago

Hello inuwan and dorotn,

I have updated a copy of the binaries built from the icu46 branch, this includes a README with some installation instructions. The icudt46l.zip contains a compressed dat file for localization data required by ICU. More information can be found on integrating SQLCipher for Android and ICU here. Also, just to verify, are you calling the SQLiteDatabase.openOrCreateDatabase? Are you also calling SQLiteDatabase.loadLibs before you attempt to get a reference to the SQLiteDatabase?

http://dl.dropbox.com/u/258698/icu46.zip

inuwan commented 12 years ago

Getting the same exception when I call getReadableDatabase using the icu46.zip.

I call loadLibs before getting a reference to the database. I do not call SQLiteDatabase.openOrCreateDatabase, I simply create a new instance of a SQLiteOpenHelper subclass that overrides onCreate, etc. SQLiteOpenHelper I believe calls openOrCreateDatabase.

-----Original Message----- From: Nick Parker [mailto:reply@reply.github.com] Sent: Monday, January 09, 2012 1:01 PM To: Mori, Ken Subject: Re: [android-database-sqlcipher] SQLCipher Fatal Exception on Android 4.0 (#36)

Hello inuwan and dorotn,

I have updated a copy of the binaries built from the icu46 branch, this includes a README with some installation instructions. The icudt46l.zip contains a compressed dat file for localization data required by ICU. More information can be found on integrating SQLCipher for Android and ICU here. Also, just to verify, are you calling the SQLiteDatabase.openOrCreateDatabase? Are you also calling SQLiteDatabase.loadLibs before you attempt to get a reference to the SQLiteDatabase?

http://dl.dropbox.com/u/258698/icu46.zip


Reply to this email directly or view it on GitHub: https://github.com/guardianproject/android-database-sqlcipher/issues/36#issuecomment-3420221

inuwan commented 12 years ago

Nix that - looks like its working. Thanks (I first only updated sqlcipher.jar, but worked after I update all the other libs in the zip

developernotes commented 12 years ago

Hi inuwan,

Glad to hear you got everything working!

superfell commented 12 years ago

I tested this build with our app on a number of devices and didn't see any problems (we were seeing the same problem as above on 4.0 with the previous builds) Galaxy Nexus running 4.0.2 Galaxy Tab running 3.1 Galaxy S2 running 2.3.6 Galaxy S running 2.2

[Apparently i'm keeping samsung in business]

developernotes commented 12 years ago

Hi Simon,

Thanks for doing some testing of the new branch - that's great feedback!

developernotes commented 12 years ago

This issue is closed