1

Although This question has been asked many time but they all are discussing about Sqlite Database. But in my Application I am using Content Provider for database. and I am using this for chat window.Using aSmack Lib.

Below is exception I am getting.

Fatal Exception: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
   at android.database.sqlite.SQLiteConnection.nativeOpen(SQLiteConnection.java)
   at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
   at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
   at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
   at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
   at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
   at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:806)
   at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:791)
   at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
   at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:1188)
   at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:267)
   at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
   at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
   at com.adgyde.android.j.<init>(Unknown Source)
   at com.adgyde.android.h.f(Unknown Source)
   at com.adgyde.android.h.a(Unknown Source)
   at com.adgyde.android.o.handleMessage(Unknown Source)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:135)
   at android.app.ActivityThread.main(ActivityThread.java:5318)
   at java.lang.reflect.Method.invoke(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:922)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:717)

Note: I am getting this on fewer devices Like Vivo,Intex etc. But not on other devices Like Moto G,Samsung Note etc.

Some body has suggested about Write Storage permssion,Which I have declared in manifest. Other has suggested to ask at run time.

Please help me in right direction.

Suraj Makhija
  • 1,376
  • 8
  • 16
Kshitij Vyas
  • 83
  • 1
  • 9
  • Just got the same happen to my app in production today. Check this link, you probably should check the permission before trying to access the database, https://stackoverflow.com/questions/17034511/android-database-sqlite-sqlitecantopendatabaseexception-unknown-error-code-14 – David Magalhães May 09 '17 at 12:10
  • Hey David, As I mentioned I have given permission in manifest.. and App is working fine on Motorala G4 , HTC,Samsung, but giving error mostly on VIVO ,Intex and OPPO devices. and 5.1.1 android(Lolipop). I am getting info from CrashList. – Kshitij Vyas May 09 '17 at 12:20
  • In what Android versions that happen ? Mine was on 6.0, and since API 23 user can opt out for giving the permission. I need to write a check like this: `int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permissionCheck != PackageManager.PERMISSION_GRANTED) { ... Not granted ... } else { ... Granted ... }` – David Magalhães May 09 '17 at 12:42
  • on device u find that is getting problem what is os version of that? – Pavan May 09 '17 at 12:52
  • @Pavan as mentioned above. Its happening more in Vivo and intex and version is 5.1.1 its workking fine on other devices. – Kshitij Vyas May 10 '17 at 04:45
  • Can you post code from which getting this is it from background or something – Pavan May 10 '17 at 05:03

0 Answers0