unable to open database file 求解决方法

蓝红雨田 发布于 2012/04/18 12:25
阅读 13K+
收藏 0

Adb Error log 如下:

E/AndroidRuntime(  490): FATAL EXCEPTION: main
E/AndroidRuntime(  490): java.lang.RuntimeException: Unable to create service com.beyond.AlertService: android.database.sqlite.SQLiteException: unable to open database file
E/AndroidRuntime(  490):  at android.app.ActivityThread.handleCreateService(ActivityThread.java:1955)
E/AndroidRuntime(  490):  at android.app.ActivityThread.access$2500(ActivityThread.java:117)
E/AndroidRuntime(  490):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985)
E/AndroidRuntime(  490):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  490):  at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(  490):  at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(  490):  at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  490):  at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(  490):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:875)
E/AndroidRuntime(  490):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
E/AndroidRuntime(  490):  at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  490): Caused by: android.database.sqlite.SQLiteException: unable to open database file
E/AndroidRuntime(  490):  at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
E/AndroidRuntime(  490):  at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1849)
E/AndroidRuntime(  490):  at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820)
E/AndroidRuntime(  490):  at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:854)
E/AndroidRuntime(  490):  at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:847)
E/AndroidRuntime(  490):  at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:549)
E/AndroidRuntime(  490):  at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
E/AndroidRuntime(  490):  at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:118)
E/AndroidRuntime(  490):  at com.beyond.sqlite.myDatabaseHelper.getWritableDatabase(myDatabaseHelper.java:143)
E/AndroidRuntime(  490):  at com.beyond.AlertService.onCreate(AlertService.java:175)
E/AndroidRuntime(  490):  at android.app.ActivityThread.handleCreateService(ActivityThread.java:1945)
E/AndroidRuntime(  490):  ... 10 more
首次下载应用时,会出现如上情况,求如何解决此问题

加载中
0
贺路的路
贺路的路
SQLiteDatabase.openOrCreateDatabase(DBPath, null);
检查这个DBPath,它应该是这样的格式/../../xx.db
贺路的路
贺路的路
回复 @sskill : ~ ~
sskill
sskill
就是这样
返回顶部
顶部