Skip to content

Error copying icu data fileicudt46l.zip on Android 4.1.1 #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
commonsguy opened this issue Sep 12, 2012 · 5 comments
Closed

Error copying icu data fileicudt46l.zip on Android 4.1.1 #64

commonsguy opened this issue Sep 12, 2012 · 5 comments

Comments

@commonsguy
Copy link
Collaborator

Environment: Android 4.1.1 (Nexus S), 4.1 (ARM emulator); SQLCipher for Android 2.0.8

Symptoms: On getWriteableDatabase() call in SQLiteDatabase, an error is logged to LogCat (Error copying icu data fileicudt46l.zip), and the attempt to open the database fails in dbopen():

09-12 09:14:34.004: I/TestRunner(16903): net.sqlcipher.database.SQLiteException: not an error
09-12 09:14:34.004: I/TestRunner(16903): at net.sqlcipher.database.SQLiteDatabase.dbopen(Native Method)
09-12 09:14:34.004: I/TestRunner(16903): at net.sqlcipher.database.SQLiteDatabase.(SQLiteDatabase.java:1952)
09-12 09:14:34.004: I/TestRunner(16903): at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:902)
09-12 09:14:34.004: I/TestRunner(16903): at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:945)
09-12 09:14:34.004: I/TestRunner(16903): at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:107)

The same code works fine on 4.0.3 (emulator).

You can see this in action via https://github.com/commonsguy/cwac-prefs (a SharedPreferences implementation that uses SQLCipher for Android as a backing store). The test suite (in the tests/ sub-project) runs fine on 4.0.3 and fails on 4.1.x.

@developernotes
Copy link
Member

Hi Mark,

We have a test that exercies the getWritableDatabase call and passes on a 4.1.1 emulator using the 2.0.8 binaries. Can you verify you are bundling the icudt46l.zip file within your assets directory? The unzipping of the icudt46l.zip file occurs during the loadLibs() call. What results do you receive when you run the SQLCipher for Android test suite?

@commonsguy
Copy link
Collaborator Author

Can you verify you are bundling the icudt46l.zip file within your assets directory?

Yes, you can see it in the project that I cited in the issue.

The unzipping of the icudt46l.zip file occurs during the loadLibs() call.

Where does it get unzipped to? My call to loadLibs() is the statement immediately before my getWritableDatabase() call, so I am sure that loadLibs() is being called.

What results do you receive when you run the SQLCipher for Android test suite?

It succeeds. One difference between my test suite and yours is that mine is a separate JUnit test suite, following the Android test instrumentation approach, whereas yours is a regular app that happens to run tests.

@commonsguy
Copy link
Collaborator Author

Where does it get unzipped to?

Never mind, I see that in the code. The icu/ directory is being made, but the file is not appearing there. I will investigate further... after filing another issue. :-)

@commonsguy
Copy link
Collaborator Author

OK, I get it now.

My main project -- an Android library project -- had SQLCipher for Android in it. My test project referenced the main project as an Android library project. However, assets/ are not shared from an Android library project to the host project, and so the test code was failing with an AssetNotFoundException. Copying the icudt46l.zip into the test project's assets/ cleared this up. I am not completely certain why my original code succeeds on earlier versions of Android, though.

Anyway, issue resolved -- thanks for the help!

@developernotes
Copy link
Member

Hi Mark,

Thanks for following up, glad to hear your issue is resolved. We use a regular Android project over JUnit tests as it allows us to test the implementation easily across various Android emulators. It may have succeeded on previous devices/emulators if the icudt46l.dat file was already present in the /system/usr/icu directory as it is on certain Android versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants