项目中用到了android-priority-jobqueue-2.0.1这个开源库,发包给测试的时候发现有时候APP会闪退,查了下报错信息,主要是下面这段
android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. at android.database.CursorWindow.<init>(CursorWindow.java:104) at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198) at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:139) at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:133) at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:197) at android.database.AbstractCursor.moveToNext(AbstractCursor.java:245) at com.birbit.android.jobqueue.persistentQueue.sqlite.SqliteJobQueue.nextJobAndIncRunCount(SqliteJobQueue.java:297) at com.birbit.android.jobqueue.cachedQueue.CachedJobQueue.nextJobAndIncRunCount(CachedJobQueue.java:79) at com.birbit.android.jobqueue.JobManagerThread.getNextJob(JobManagerThread.java:665) at com.birbit.android.jobqueue.JobManagerThread.getNextJob(JobManagerThread.java:642) at com.birbit.android.jobqueue.ConsumerManager.handleIdle(ConsumerManager.java:199) at com.birbit.android.jobqueue.JobManagerThread$1.handleMessage(JobManagerThread.java:231) at com.birbit.android.jobqueue.messaging.PriorityMessageQueue.consume(PriorityMessageQueue.java:39) at com.birbit.android.jobqueue.JobManagerThread.run(JobManagerThread.java:222) at java.lang.Thread.run(Thread.java:856)查了下源码~还真是cursor没关闭的原因~自己改了下源码,打包了个aar~做下记录备用
下载地址:http://download.csdn.net/detail/wwwkp1236/9845752