Issue
When working on Android and trying to install a pre-populated database Encrypted database module and open is throwing the following error:
[INFO] Database: sqlite returned: error code = 26, msg = file is encrypted or is not a database
[ERROR] Database: CREATE TABLE android_metadata failed
[ERROR] Database: Failed to setLocale() when constructing, closing the database
[ERROR] Database: net.sqlcipher.database.SQLiteException: file is encrypted or is not a database
[ERROR] Database: at net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method)
[ERROR] Database: at net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2102)
[ERROR] Database: at net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:1968)
[ERROR] Database: at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:901)
[ERROR] Database: at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:929)
[ERROR] Database: at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:936)
[ERROR] Database: at appcelerator.encrypteddatabase.EncrypteddatabaseModule.open(EncrypteddatabaseModule.java:83)
[ERROR] Database: at appcelerator.encrypteddatabase.EncrypteddatabaseModule.install(EncrypteddatabaseModule.java:145)
[ERROR] Database: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] Database: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[ERROR] Database: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:908)
[ERROR] Database: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1131)
[ERROR] Database: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347)
[ERROR] Database: at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:101)
[ERROR] Database: at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:424)
[ERROR] Database: at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR] Database: at android.os.Looper.loop(Looper.java:137)
[ERROR] Database: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[WARN] W/System.err: java.lang.NullPointerException
[WARN] W/System.err: at appcelerator.encrypteddatabase.EncrypteddatabaseModule.open(EncrypteddatabaseModule.java:90)
[WARN] W/System.err: at appcelerator.encrypteddatabase.EncrypteddatabaseModule.install(EncrypteddatabaseModule.java:145)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[WARN] W/System.err: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:908)
[WARN] W/System.err: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1131)
[WARN] W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347)
[WARN] W/System.err: at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:101)
[WARN] W/System.err: at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:424)
[WARN] W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
[WARN] W/System.err: at android.os.Looper.loop(Looper.java:137)
[WARN] W/System.err: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[ERROR] TiExceptionHandler: (main) [947,947] ----- Titanium Javascript Runtime Error -----
[ERROR] TiExceptionHandler: (main) [0,947] - In ti:/invoker.js:101,19
[ERROR] TiExceptionHandler: (main) [0,947] - Message: Uncaught Error: Java Exception occurred
[ERROR] TiExceptionHandler: (main) [1,948] - Source: return delegate.apply(invoker.__thisObj__, args);
[ERROR] V8Exception: Exception occurred at ti:/invoker.js:101: Uncaught Error: Java Exception occurred
During research i found some similar issues in native development:
http://stackoverflow.com/questions/13537073/android-sqlcipher-pragma-problems
http://stackoverflow.com/questions/20373066/sqlcipher-create-table-android-metadata-failed
Steps to reproduce
1. Run alloySample (attached alloySample.zip)
Expected Result
The database will install and run correctly
Actual Result
We receive the following error "sqlite returned: error code = 26, msg = file is encrypted or is not a database"
[~cng] Can you please schedule this for an upcoming sprint?
[~hpham], can you please take a look at this? Thanks.