NoHttp icon indicating copy to clipboard operation
NoHttp copied to clipboard

SQLiteDatabaseLockedException

Open shiwobuhaoma opened this issue 6 years ago • 2 comments

#2992 android.database.sqlite.SQLiteDatabaseLockedException

database is locked (code 5): , while compiling: PRAGMA journal_mode

com.yanzhenjie.nohttp.db.BaseDao.getWriter(BaseDao.java:60)

java.lang.RuntimeException:Unable to create application com.stub.StubApp: android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5): , while compiling: PRAGMA journal_mode

2 android.app.ActivityThread.handleBindApplication(ActivityThread.java:5003) 3 ...... 4 Caused by: 5 android.database.sqlite.SQLiteDatabaseLockedException:database is locked (code 5): , while compiling: PRAGMA journal_mode 6 android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) 7 android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:898) 8 android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:643) 9 android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:325) 10 android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:299) 11 android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:220) 12 android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:198) 13 android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463) 14 android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185) 15 android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177) 16 android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:836) 17 android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:821) 18 android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:714) 19 android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:1282) 20 android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:268) 21 android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223) 22 android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163) 23 com.yanzhenjie.nohttp.db.BaseDao.getWriter(BaseDao.java) 24 com.yanzhenjie.nohttp.db.BaseDao.delete(BaseDao.java) 25 com.yanzhenjie.nohttp.cookie.DBCookieStore.(DBCookieStore.java)

shiwobuhaoma avatar Sep 14 '17 08:09 shiwobuhaoma

是不是Applicaiton的问题?

yanzhenjie avatar Sep 15 '17 03:09 yanzhenjie

@yanzhenjie NoHttp.initialize(this, new NoHttp.Config() // 设置全局连接超时时间,单位毫秒,默认10s。 .setConnectTimeout(10 * 1000) // 设置全局服务器响应超时时间,单位毫秒,默认10s。 .setReadTimeout(10 * 1000) // 配置缓存,默认保存数据库DBCacheStore,保存到SD卡使用DiskCacheStore。 .setCacheStore( new DBCacheStore(this).setEnable(true) // 如果不使用缓存,设置setEnable(false)禁用。 ) // 配置Cookie,默认保存数据库DBCookieStore,开发者可以自己实现。 .setCookieStore( new DBCookieStore(this).setEnable(true) // 如果不维护cookie,设置false禁用。 ) // 配置网络层,默认使用URLConnection,如果想用OkHttp:OkHttpNetworkExecutor。 .setNetworkExecutor(new URLConnectionNetworkExecutor()) );

Application中的配置就这么多。

shiwobuhaoma avatar Sep 20 '17 12:09 shiwobuhaoma