0

I'm integrating SQLCipher in a application with a SQLite Db. when the app is launch, I receive a "application has stopped unexpectedly" error. When I look at LogCat I see the initial error is "CREATE TABLE android_metadata failed". The only change I have made to this application is adding the code to integrate SQLCIpher. I'm sure I have not coded it properly but am not sure what i missed. the following has been done:

1.java.io.file, info,guardianproject.database.sqlcipher.SQLiteDatabase, android.os.Bundle, and android.app.activity have been imported. 2. InitializeSQLCipher() has been added to the onCreate method of the splash activity

private void InitializeSQLCipher() {
    SQLiteDatabase.loadLibs(this);
    File databaseFile = getDatabasePath ("mydatabase.db");
    databaseFile.mkdirs();
    databaseFile.delete();
    SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databaseFile, "password", null);
    database.execSQL("create table t1(a, b)");
    database.execSQL("insert into t1(a, b) values(?, ?)", new Object[]{"one for the money", "two for the show"});
     }
Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
user1165694
  • 1,255
  • 2
  • 18
  • 29
  • FWIW, here is a sample app showing SQLCipher in use: https://github.com/commonsguy/cw-advandroid/tree/master/Database/ConstantsSecure – CommonsWare May 17 '12 at 14:39

3 Answers3

0

The most likely answer is that you have not moved the ICU resource files into the assets directory. Make sure you copy the icu*.zip into your assets folder and include it in your build.

Stephen Lombardo
  • 1,503
  • 8
  • 7
0

CommonsWare has provided sample code illustrating the concept. Check it out here.

Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
0

removed the "." from databasename.db (e.g.databasedb)

user1165694
  • 1,255
  • 2
  • 18
  • 29