我正在开发一个在 android 中使用 sqlite 数据库的应用程序,最近我经常遇到崩溃,我认为这与并发数据库访问有关,尽管 db 异常没有提到它。
这是错误:
09-15 15:25:45.672 195-1476/system_process V/ActivityManager﹕ Record #1 ActivityRecord{a52ecf58 u0 com.pauloslf.efatura/.MenuInicial}: app=ProcessRecord{a5317d60 0:com.pauloslf.efatura/u0a10049}
09-15 15:25:45.672 195-1476/system_process I/ActivityManager﹕ Removing activity ActivityRecord{a52ecf58 u0 com.pauloslf.efatura/.MenuInicial} from stack at 1: haveState=false stateNotNeeded=false finishing=true state=PAUSING
java.lang.RuntimeException: here
at com.android.server.am.ActivityStack.removeHistoryRecordsForAppLocked(ActivityStack.java:4249)
at com.android.server.am.ActivityManagerService.handleAppDiedLocked(ActivityManagerService.java:3015)
at com.android.server.am.ActivityManagerService.appDiedLocked(ActivityManagerService.java:3085)
at com.android.server.am.ActivityManagerService$AppDeathRecipient.binderDied(ActivityManagerService.java:897)
at android.os.BinderProxy.sendDeathNotice(Binder.java:470)
at dalvik.system.NativeStart.run(Native Method)
09-15 15:25:45.672 195-490/system_process W/InputDispatcher﹕ channel 'a5239e68 com.pauloslf.efatura/com.pauloslf.efatura.MenuInicial (server)' ~ Consumer closed input channel or an error occurred. events=0x9
09-15 15:25:45.672 195-490/system_process E/InputDispatcher﹕ channel 'a5239e68 com.pauloslf.efatura/com.pauloslf.efatura.MenuInicial (server)' ~ Channel is unrecoverably broken and will be disposed!
09-15 15:25:45.672 195-1476/system_process V/ActivityManager﹕ No result destination from ActivityRecord{a52ecf58 u0 com.pauloslf.efatura/.MenuInicial}
09-15 15:25:45.676 119-119/? D/Zygote﹕ Process 3287 terminated by signal (11)
09-15 15:25:45.684 195-1915/system_process W/InputDispatcher﹕ Attempted to unregister already unregistered input channel 'a5239e68 com.pauloslf.efatura/com.pauloslf.efatura.MenuInicial (server)'
我正在使用单例访问 db 类:
private static FacturasDB faturasdb = null;
public static FacturasDB getInstance(Context context) {
if (faturasdb == null) {
faturasdb = new FacturasDB(context);
}
return faturasdb;
}
我重现该问题的最简单方法是,当 asynctask 在主要活动上启动(后台是否访问数据库)正在运行时,我导航到另一个也使用数据库的活动。
知道为什么会发生这个问题吗?
提前非常感谢!