最近发到google et上的程序反馈回来的errors里出现了以下报错android.database.sqlite.SQLiteException: unable to open database file
at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1899)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:881)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:915)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:908)
at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:551)
at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
at com.nd.android.pandahome2.ApplicationInfoProvider.delete(ApplicationInfoProvider.java:72)
at android.content.ContentProvider$Transport.delete(ContentProvider.java:204)
at android.content.ContentResolver.delete(ContentResolver.java:675)
at com.aaa.android.launcher.ApplicationsChangeReceiver$1.run(ApplicationsChangeReceiver.java:57)
at java.lang.Thread.run(Thread.java:1102)
该代码是接收到有程序安装,更新,卸载广播时对数据库进行操作。
我用真机试了好多次都不会报这个错误,有人遇过这种报错吗?

解决方案 »

  1.   

    “一个database connect,既有查询又有更新(不同的statement,且不论顺序),执行完之后,不关闭,会产生一个扩展名为s3db-journal的(临时)文件,若再次使用该connect执行更新,则产生“unable to open database file”的异常。 
    所以,一个connect执行完之后要么close,要么自己处理临时文件。”不知道是不是这个!网上查的
      

  2.   


    我做完更新后都有显示的close...
      

  3.   

    One of the possible scenarios when this could happen -- is when you access your database file from several threads and when the file is locked by one of the threads while you're trying to open it for modifications from another thread. 
    http://stackoverflow.com/questions/3563728/random-exception-android-database-sqlite-sqliteexception-unable-to-open-database
      

  4.   

    顶 有时粗心经常忘记close
      

  5.   

    卸载应用的时候由于手机的某些问题。 导致没有删除相应的数据文件。 这时候你再装应用进入系统的时候是Android系统分配给你的用户没办法删除和修改原来应用留下的文件所造成的