问题描述
我遇到以下错误:
android.database.sqlite.SQLiteDiskIOException: error code 10: disk I/O error
at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:92)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1926)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1866)
我仅在Samsung Nexus手机上的ICS 4.0.1上收到此错误.在仿真器上,Motorola Xoom 3.2和HTC Desire 2.3.3,代码可以正常工作.我的代码针对的是SDK的版本8或2.2.x. execSQL
执行如下:
I only get this error on ICS 4.0.1 on a Samsung Nexus phone. On an emulator, a Motorola Xoom 3.2 and an HTC Desire 2.3.3, the code works fine. My code is targeted at version 8, or 2.2.x, of the SDK. The execSQL
is executed as follows:
db.execSQL("DROP TABLE IF EXISTS " + table.getTableName());
数据库存储在内部,而不存储在SD卡上.关于如何解决此问题有什么建议吗?
The database is stored internally and not on an SD card. Any suggestions on how to solve this problem?
推荐答案
解决了这个问题.
问题在于,在drop table语句之前,有一个Context.deleteDatabase('dbName')
语句显然已删除了db,因此报告的I/O错误是很有意义的.
Problem was that prior to the drop table statements there was a Context.deleteDatabase('dbName')
statement which had obviously removed the db, and the I/O error being reported then makes perfect sense.
似乎以前(不必要)使用了皮带和牙套方法.
It seems that a belt and braces approach had been used previously (unnecessarily).
但是有趣的是,直到转向ICS,这才成为问题.
However the interesting thing is that this didn't manifest as a problem until the move to ICS.
这篇关于"SQLiteDiskIOException:错误代码10:磁盘I/O错误";在DROP TABLE上在ICS和Samsung Nexus上重调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!