当前位置: 代码迷 >> Android >> 大家遇到过这个错误没android.database.sqlite.SQLiteException: unable to open database file
  详细解决方案

大家遇到过这个错误没android.database.sqlite.SQLiteException: unable to open database file

热度:37   发布时间:2016-05-01 17:59:48.0
大家遇到过这个异常没android.database.sqlite.SQLiteException: unable to open database file
这是什么问题导致的?

01-07 19:31:42.800: ERROR/AndroidRuntime(4530): FATAL EXCEPTION: AsyncTask #5
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): java.lang.RuntimeException: An error occured while executing doInBackground()
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at android.os.AsyncTask$3.done(AsyncTask.java:200)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at java.lang.Thread.run(Thread.java:1096)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): Caused by: android.database.sqlite.SQLiteException: unable to open database file: BEGIN EXCLUSIVE;
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:158)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at android.content.ContentProviderProxy.update(ContentProviderNative.java:495)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at android.content.ContentResolver.update(ContentResolver.java:707)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at android.provider.ContactsContract$Contacts.markAsContacted(ContactsContract.java:984)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at android.provider.CallLog$Calls.addCall(CallLog.java:255)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at com.android.phone.CallLogAsync$AddCallTask.doInBackground(CallLogAsync.java:165)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at com.android.phone.CallLogAsync$AddCallTask.doInBackground(CallLogAsync.java:156)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at android.os.AsyncTask$2.call(AsyncTask.java:185)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-07 19:31:42.800: ERROR/AndroidRuntime(4530): ... 4 more
01-07 19:31:43.183: WARN/ActivityManager(4455): Force finishing activity com.android.phone/.InCallScreen

------解决方案--------------------
有两种情况:1,你的数据库文件不是有效的数据库文件 ;2,你在操作sqlite数据库时使用多线程了,但sqlite数据库是不支持多线程操作,所以你必须实现多线程同步的基质;
  相关解决方案