Project: titanium
Issue TIMOB-19206: Android: Encrypted Database: Not being able to read installed database
h3. Issue When working on Android and trying to install a pre-populated database Encrypted database module and open is throwing the following error: {code} [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: net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method) [ERROR] Database: net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2102) [ERROR] Database: net.sqlcipher.database.SQLiteDatabase.(SQLiteDatabase.java:1968) [ERROR] Database: net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:901) [ERROR] Database: net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:929) [ERROR] Database: net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:936) [ERROR] Database: appcelerator.encrypteddatabase.EncrypteddatabaseModule.open(EncrypteddatabaseModule.java:83) [ERROR] Database: appcelerator.encrypteddatabase.EncrypteddatabaseModule.install(EncrypteddatabaseModule.java:145) [ERROR] Database: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [ERROR] Database: org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) [ERROR] Database: org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:908) [ERROR] Database: org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1131) [ERROR] Database: org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347) [ERROR] Database: org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:101) [ERROR] Database: ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:424) [ERROR] Database: android.os.Handler.dispatchMessage(Handler.java:95) [ERROR] Database: android.os.Looper.loop(Looper.java:137) [ERROR] Database: org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) [WARN] W/System.err: java.lang.NullPointerException [WARN] W/System.err: appcelerator.encrypteddatabase.EncrypteddatabaseModule.open(EncrypteddatabaseModule.java:90) [WARN] W/System.err: appcelerator.encrypteddatabase.EncrypteddatabaseModule.install(EncrypteddatabaseModule.java:145) [WARN] W/System.err: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [WARN] W/System.err: org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) [WARN] W/System.err: org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:908) [WARN] W/System.err: org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1131) [WARN] W/System.err: org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347) [WARN] W/System.err: org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:101) [WARN] W/System.err: ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:424) [WARN] W/System.err: android.os.Handler.dispatchMessage(Handler.java:95) [WARN] W/System.err: android.os.Looper.loop(Looper.java:137) [WARN] W/System.err: 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 {code} 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 h3. 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"
Story points: 8