这是在anr.txt中找到的跟踪
"main" prio=5 tid=1 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x41663508 self=0x412e3b58
| sysTid=7186 nice=0 sched=0/0 cgrp=apps handle=1075322672
| schedstat=( 52016072596 286093565179 144215 ) utm=4431 stm=770 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x416635d8> (a java.lang.VMThread) held by tid=1 (main)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:197)
at android.database.sqlite.SQLiteConnectionPool.waitForConnection(SQLiteConnectionPool.java:680)
at android.database.sqlite.SQLiteConnectionPool.acquireConnection(SQLiteConnectionPool.java:349)
at android.database.sqlite.SQLiteSession.acquireConnection(SQLiteSession.java:894)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:586)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1200)
at com.lenovo.vcs.weaver.cache.CacheDBProvider.query(CacheDBProvider.java:202)
at com.lenovo.vcs.weaver.cache.CacheDBProvider.query(CacheDBProvider.java:190)
at android.content.ContentProvider.query(ContentProvider.java:652)
at android.content.ContentProvider$Transport.query(ContentProvider.java:189)
at android.content.ContentResolver.query(ContentResolver.java:372)
at android.content.ContentResolver.query(ContentResolver.java:315)
at com.lenovo.vcs.weaver.cache.service.PictureUrlCacheService.query(PictureUrlCacheService.java:45)
at com.lenovo.vcs.weaver.util.PicUrlUtil.getOldUrl(PicUrlUtil.java:77)
at com.lenovo.vcs.weaver.util.PicUrlUtil.getOldUrlMid(PicUrlUtil.java:25)
at com.lenovo.vcs.weaver.profile.MoreViewGenerator.setImg(MoreViewGenerator.java:824)
at com.lenovo.vcs.weaver.profile.MoreViewGenerator.initAccountPic(MoreViewGenerator.java:818)
at com.lenovo.vcs.weaver.profile.MoreViewGenerator.refreshUIData(MoreViewGenerator.java:1108)
at com.lenovo.vcs.weaver.profile.MoreViewGenerator.onResume(MoreViewGenerator.java:1059)
at com.lenovo.vcs.weaver.main.NavigationActivity.onResume(NavigationActivity.java:178)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1199)
at com.qihoo360.mobilesafe.loader.b.callActivityOnResume(SourceFile:123)
at android.app.Activity.performResume(Activity.java:5265)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2606)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2644)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
at dalvik.system.NativeStart.main(Native Method)
通常我会尝试找出对象保持线程正在做什么,在这种情况下我不能这样做,因为你可以看到主线程被唯一的主线程本身阻止,我不知道认为这在理论上是可行的。
我知道在主线程中执行数据库操作不是一个好习惯,我打算纠正它。
到目前为止,我只能在Android 4.4中找到它,我不确定问题是否只发生在主线程中。有没有人遇到过这个问题,或者只是我有这种运气。