{"action":"created","issue":{"url":"https://api.github.com/repos/sqlcipher/android-database-sqlcipher/issues/161","labels_url":"https://api.github.com/repos/sqlcipher/android-database-sqlcipher/issues/161/labels{/name}","comments_url":"https://api.github.com/repos/sqlcipher/android-database-sqlcipher/issues/161/comments","events_url":"https://api.github.com/repos/sqlcipher/android-database-sqlcipher/issues/161/events","html_url":"https://github.com/sqlcipher/android-database-sqlcipher/issues/161","id":72636936,"number":161,"title":"attempt to write a readonly database, crashes on android 5.0v devices while using SqlCipher","user":{"login":"praveenb","id":592596,"avatar_url":"https://avatars.githubusercontent.com/u/592596?v=3","gravatar_id":"","url":"https://api.github.com/users/praveenb","html_url":"https://github.com/praveenb","followers_url":"https://api.github.com/users/praveenb/followers","following_url":"https://api.github.com/users/praveenb/following{/other_user}","gists_url":"https://api.github.com/users/praveenb/gists{/gist_id}","starred_url":"https://api.github.com/users/praveenb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praveenb/subscriptions","organizations_url":"https://api.github.com/users/praveenb/orgs","repos_url":"https://api.github.com/users/praveenb/repos","events_url":"https://api.github.com/users/praveenb/events{/privacy}","received_events_url":"https://api.github.com/users/praveenb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-05-02T12:07:30Z","updated_at":"2015-05-29T11:54:03Z","closed_at":null,"body":"Im getting following log on app crash, on android 5.0v devices\r\n\r\nCaused by: net.sqlcipher.database.SQLiteException: attempt to write a readonly database\r\nat net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method)\r\nat net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2096)\r\nat net.sqlcipher.database.SQLiteDatabase.(SQLiteDatabase.java:1962)\r\nat net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:881)\r\nat net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:913)\r\nat net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:132)\r\nat net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:99)\r\nat PackageName.DBHelperCipher.(DBHelperCipher.java:93)\r\nat PackageName.ProcessDBCipherInitTask.doInBackground(ProcessDBCipherInitTask.java:20)\r\nat PackageName.ProcessDBCipherInitTask.doInBackground(ProcessDBCipherInitTask.java:1)\r\nat android.os.AsyncTask$2.call(AsyncTask.java:288)\r\nat java.util.concurrent.FutureTask.run(FutureTask.java:237)\r\n\r\nI've submitted a question on StackOverflow, http://stackoverflow.com/q/29988933/341443.\r\nCan you please help on this.\r\n\r\nThank you."},"comment":{"url":"https://api.github.com/repos/sqlcipher/android-database-sqlcipher/issues/comments/106782279","html_url":"https://github.com/sqlcipher/android-database-sqlcipher/issues/161#issuecomment-106782279","issue_url":"https://api.github.com/repos/sqlcipher/android-database-sqlcipher/issues/161","id":106782279,"user":{"login":"brodybits","id":1559888,"avatar_url":"https://avatars.githubusercontent.com/u/1559888?v=3","gravatar_id":"","url":"https://api.github.com/users/brodybits","html_url":"https://github.com/brodybits","followers_url":"https://api.github.com/users/brodybits/followers","following_url":"https://api.github.com/users/brodybits/following{/other_user}","gists_url":"https://api.github.com/users/brodybits/gists{/gist_id}","starred_url":"https://api.github.com/users/brodybits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brodybits/subscriptions","organizations_url":"https://api.github.com/users/brodybits/orgs","repos_url":"https://api.github.com/users/brodybits/repos","events_url":"https://api.github.com/users/brodybits/events{/privacy}","received_events_url":"https://api.github.com/users/brodybits/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T11:54:03Z","updated_at":"2015-05-29T11:54:03Z","body":"According to the documentation in http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html, and also in the Javadoc, it is possible that `SQLiteDatabase.openDatabase` (and `SQLiteDatabase.openOrCreateDatabase()`) can throw a `SQLiteException` if it cannot open the database for some reason. It should be the responsibility of the application to catch and handle this error. I wonder if we should add `throws SQLException` to the declaration of these functions to avoid these crashes?"}}