4

My application is throwing this

Fatal Exception : unknown error (code 14) could not open database

when running on Android Kitkat 4.4, The application is running perfectly on all the previous versions.

Exception is being thrown in this line.

            myDataBase = SQLiteDatabase.openDatabase("path", null, SQLiteDatabase.OPEN_READWRITE);

I have tried everything from SQLiteDatabase.create(); SQLiteDatabase.opendatabase(); SQLiteDatabase.openorcreatedatabase(null); . But still the exception is being thrown in this line.

Anchal
  • 859
  • 1
  • 10
  • 21
  • see this : http://stackoverflow.com/questions/7316191/android-sqlite-returned-error-code-14 and this : http://stackoverflow.com/questions/6202926/android-sqliteopenhelper-cannot-open-database-file – Waqar Ahmed Mar 21 '14 at 08:52
  • nope not working..first link is to set sharedUserID in manifest which i am not doing and other link does not have accepted answer – Anchal Mar 21 '14 at 09:22

1 Answers1

0

If your variable path is a secondary external storage as a sdcard then you can not write data, how to create a db file sqlite . Android 4.4 prevented the writing of data at this location and manufacturers as Samsung has followed the same. The error message does not help to know what is really happening. See :

https://source.android.com/devices/storage/index.html#multiple-external-storage-devices

molabss
  • 1
  • 1
  • 4