android 存储ANR问题的traces.txt
android系统在发生ANR的情况下会保存到/data/anr/traces.txt文件中,来记录发生ANR的时间等信息
打开traces.txt,分析一下
第一行,是时间
第二行,是应用包名
第三行,线程大概信息
... ...
第N行,loadImageFromUrl方法以及对应的DazhuAsyncTask.java文件,后面的数字为DazhuAsyncTask.ava文件的第120行
----- pid 9295 at 2012-11-14 20:47:41 ----- Cmd line: com.dazhu.phone DALVIK THREADS: (mutexes: tll=0 tsl=0 tscl=0 ghl=0) "main" prio=5 tid=1 NATIVE | group="main" sCount=1 dsCount=0 obj=0x40c66568 self=0x40bf6ab0 | sysTid=9295 nice=0 sched=0/0 cgrp=apps handle=1075349040 | schedstat=( 0 0 0 ) utm=5828 stm=1438 core=0 #00 pc 0000dc70 /system/lib/libc.so (__futex_syscall3+8) #01 pc 00012bd4 /system/lib/libc.so (__pthread_cond_timedwait_relative+48) #02 pc 00012c30 /system/lib/libc.so (__pthread_cond_timedwait+60) #03 pc 00052bb5 /system/lib/libdvm.so (dvmChangeStatus(Thread*, ThreadStatus)+68) #04 pc 0004882d /system/lib/libdvm.so #05 pc 00047181 /system/lib/libandroid_runtime.so (android::AndroidRuntime::getJNIEnv()+16) #06 pc 000556e1 /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::handleEvent(int, int, void*)+64) #07 pc 00014935 /system/lib/libutils.so (android::Looper::pollInner(int)+516) #08 pc 000149f9 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+104) #09 pc 0005d11b /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22) #10 pc 0001de30 /system/lib/libdvm.so (dvmPlatformInvoke+112) #11 pc 0004ce73 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+390) #12 pc 00027260 /system/lib/libdvm.so #13 pc 0002bb38 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180) #14 pc 0005f877 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374) #15 pc 00066d4d /system/lib/libdvm.so #16 pc 00027260 /system/lib/libdvm.so #17 pc 0002bb38 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180) #18 pc 0005f5b1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272) #19 pc 000494cb /system/lib/libdvm.so #20 pc 0004698d /system/lib/libandroid_runtime.so #21 pc 0004746f /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390) #22 pc 00000dcf /system/bin/app_process #23 pc 00016eab /system/lib/libc.so (__libc_init+38) #24 pc 00000b34 /system/bin/app_process at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:125) at android.os.Looper.loop(Looper.java:124) at android.app.ActivityThread.main(ActivityThread.java:4745) 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:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) "DazhuAsyncTask #3" prio=5 tid=24 SUSPENDED | group="main" sCount=1 dsCount=0 obj=0x416de600 self=0x51245908 | sysTid=9365 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1361337688 | schedstat=( 0 0 0 ) utm=37 stm=6 core=0 at libcore.io.Posix.socket(Native Method) at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:181) at libcore.io.IoBridge.socket(IoBridge.java:568) at java.net.PlainSocketImpl.create(PlainSocketImpl.java:201) at java.net.Socket.checkOpenAndCreate(Socket.java:663) at java.net.Socket.connect(Socket.java:807) at libcore.net.http.HttpConnection.<init>(HttpConnection.java:76) at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50) at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341) at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315) at libcore.net.http.HttpEngine.connect(HttpEngine.java:310) at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289) at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239) at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273) at libcore.net.http.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:130) at java.net.URLConnection.getContentType(URLConnection.java:326) at java.net.URLConnection.getContent(URLConnection.java:193) at java.net.URL.getContent(URL.java:447) at com.dazhu.http.AsyncImageLoader.loadImageFromUrl(AsyncImageLoader.java:120) at com.dazhu.http.AsyncImageLoader$2.doInBackground(AsyncImageLoader.java:74) at com.dazhu.http.AsyncImageLoader$2.doInBackground(AsyncImageLoader.java:69) at com.dazhu.phone.DazhuAsyncTask$2.call(YoukuAsyncTask.java:95) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856)
... ...
----- end 6054 -----
最后,这也是借鉴网络上的牛人。写了快一下午,中间还去开了个会儿。开会真折磨人~~~~
我要青春像陈孝正一样,不能有一毫米的误差!
我要青春像合伙人一样,为了自尊而战!