Android SQLiteException:无法将db的区域设置更改为“en_US”

前端之家收集整理的这篇文章主要介绍了Android SQLiteException:无法将db的区域设置更改为“en_US”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我最近更新了一个(开源) Android应用程序,我的用户正在收到一个我无法复制的异常.关键部分是:

android.database.sqlite.sqliteDatabaseLockedException:数据库被锁定(代码5)

接着

导致:android.database.sqlite.sqliteException:无法将db’/data/data/com.airlocksoftware.hackernews/databases/hacker_news_cache.db’的区域设置更改为“en_US”.

这是在Android 2.3 – 4.2.1的设备上,以及在我尝试连接到数据库的应用程序的多个位置.我使用它后关闭数据库.

我找不到关于“无法更改数据库区域设置”异常的信息.当我看到source for SQLiteConnection (line 386)时,似乎是“android_Metadata”表或“使用新的区域设置更新索引”的问题.

Here is the code that’s causing the exception (on Github).

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:137)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856) Caused by: android.database.sqlite.sqliteException: Failed to change locale for db '/data/data/com.airlocksoftware.hackernews/databases/hacker_news_cache.db' to 'en_US'.
at android.database.sqlite.sqliteConnection.setLocaleFromConfiguration(sqliteConnection.java:386)
at android.database.sqlite.sqliteConnection.open(sqliteConnection.java:218)
at android.database.sqlite.sqliteConnection.open(sqliteConnection.java:193)
at android.database.sqlite.sqliteConnectionPool.openConnectionLocked(sqliteConnectionPool.java:463)
at android.database.sqlite.sqliteConnectionPool.open(sqliteConnectionPool.java:185)
at android.database.sqlite.sqliteConnectionPool.open(sqliteConnectionPool.java:177)
at android.database.sqlite.sqliteDatabase.openInner(sqliteDatabase.java:804)
at android.database.sqlite.sqliteDatabase.open(sqliteDatabase.java:789)
at android.database.sqlite.sqliteDatabase.openDatabase(sqliteDatabase.java:694)
at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:854)
at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
at android.database.sqlite.sqliteOpenHelper.getDatabaseLocked(sqliteOpenHelper.java:224)
at android.database.sqlite.sqliteOpenHelper.getWritableDatabase(sqliteOpenHelper.java:164)
at com.airlocksoftware.database.DbInterface.(DbInterface.java:28)
at com.airlocksoftware.hackernews.loader.StoryLoader.loadStories(StoryLoader.java:62)
at com.airlocksoftware.hackernews.loader.StoryLoader.loadInBackground(StoryLoader.java:54)
at com.airlocksoftware.hackernews.loader.StoryLoader.loadInBackground(StoryLoader.java:1)
at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40)
at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
... 3 more Caused by: android.database.sqlite.sqliteDatabaseLockedException: database is locked (code 5)
at android.database.sqlite.sqliteConnection.nativeExecute(Native Method)
at android.database.sqlite.sqliteConnection.execute(sqliteConnection.java:548)
at android.database.sqlite.sqliteConnection.setLocaleFromConfiguration(sqliteConnection.java:364)
... 24 more

解决方法

这并不能完全回答这个问题,但是您可能还想查看这篇文章,看看您是否可以将其用于DbHelperSingleton,因为它似乎与您面临的错误相同:

Failed to change locale for db ‘/data/data/my.easymedi.controller/databases/EasyMediInfo.db’ to ‘en_US’

原文链接:https://www.f2er.com/android/311710.html

猜你在找的Android相关文章