Random exception android.database.sqlite.SQLiteException: unable to open database file

后端 未结 7 592
孤街浪徒
孤街浪徒 2020-12-14 07:59

My app uses a uncaught exception handler that sends the stack trace to me when the app crashes. Often I get this report from random users.

I cannot replicate it, th

7条回答
  •  心在旅途
    2020-12-14 08:33

    For any database application , I create the sqlite database first with Sqlite Manager addon of Firefox and take it in /res/raw folder. Then in my code, I check if the database exists in /data/data for this app. If not , I copy the db file to that directory with my code.

    For your situation, it's hard to determine the exact reason without seeing how you have created your database and how are you using it.There can be several reason for the issue of getting this exception. Some issues already mentioned by others. I want to mention a one. Can you try opening the database like this

    SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.NO_LOCALIZED_COLLATORS);  
    

    Probably, I could try better to help if you show your code snippets. Well, my methods are described here , you can take a look if that helps.

    Populating SQLite Database

提交回复
热议问题