0

誰かお願いします。Android アプリの次の ANR の分析を手伝ってください。私はANRの世界に不慣れです。

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x40ce24c0 self=0x185da18
| sysTid=2641 nice=0 sched=0/0 cgrp=default handle=1075160444
| schedstat=( 13982089096 731925534 8330 ) utm=1371 stm=27 core=0
at android.graphics.Paint.native_getTextRunAdvances(Native Method)
at android.graphics.Paint.getTextRunAdvances(Paint.java:1683)
at android.graphics.Paint.getTextRunAdvances(Paint.java:1649)
at android.text.MeasuredText.addStyleRun(MeasuredText.java:168)
at android.text.MeasuredText.addStyleRun(MeasuredText.java:200)
at android.text.StaticLayout.generate(StaticLayout.java:281)
at android.text.DynamicLayout.reflow(DynamicLayout.java:283)
at android.text.DynamicLayout.<init>(DynamicLayout.java:169)
at android.widget.TextView.makeSingleLayout(TextView.java:6471)
at android.widget.TextView.makeNewLayout(TextView.java:6369)
at android.widget.TextView.onMeasure(TextView.java:6715)
at android.view.View.measure(View.java:12790)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4788)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1374)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:663)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
at android.view.View.measure(View.java:12790)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1164)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
at android.widget.ScrollView.onMeasure(ScrollView.java:312)
at android.view.View.measure(View.java:12790)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:594)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:376)
at android.view.View.measure(View.java:12790)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4788)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
at android.view.View.measure(View.java:12790)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:815)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
at android.view.View.measure(View.java:12790)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4788)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2218)
at android.view.View.measure(View.java:12790)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1147)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2642)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4624)
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:965)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:732)
at dalvik.system.NativeStart.main(Native Method)

"Thread-275" prio=5 tid=19 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x419c17e8 self=0x1bc3948
| sysTid=2679 nice=0 sched=0/0 cgrp=default handle=28864560
| schedstat=( 14379768 4029537 49 ) utm=0 stm=1 core=1
at dalvik.system.NativeStart.run(Native Method)

"AsyncTask #2" prio=5 tid=18 WAIT
| group="main" sCount=1 dsCount=0 obj=0x41846738 self=0x1a5ae10
| sysTid=2678 nice=10 sched=0/0 cgrp=bg_non_interactive handle=28757152
| schedstat=( 373307 159769 2 ) utm=0 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x41841e48> (a java.lang.VMThread) held by tid=18 (AsyncTask #2)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)

"Thread-271" prio=5 tid=17 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x419ae098 self=0x1b56b98
| sysTid=2674 nice=0 sched=0/0 cgrp=default handle=28672672
| schedstat=( 21873077 12209999 79 ) utm=2 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x419aaf98> (a com.google.ads.internal.c)
at java.lang.Object.wait(Object.java:401)
at com.google.ads.internal.c.run(SourceFile:756)
at java.lang.Thread.run(Thread.java:856)

"Thread-268" prio=5 tid=12 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x4198b428 self=0x1b35a88
| sysTid=2671 nice=0 sched=0/0 cgrp=default handle=28578968
| schedstat=( 24263467 36899769 115 ) utm=0 stm=2 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x41986178> (a com.google.ads.internal.c)
at java.lang.Object.wait(Object.java:401)
at com.google.ads.internal.c.run(SourceFile:756)
at java.lang.Thread.run(Thread.java:856)

"AsyncTask #1" prio=5 tid=14 WAIT
| group="main" sCount=1 dsCount=0 obj=0x4146c868 self=0x1ab9608
| sysTid=2665 nice=10 sched=0/0 cgrp=bg_non_interactive handle=28020336
| schedstat=( 5055464 9107460 14 ) utm=0 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x41828438> (a java.lang.VMThread) held by tid=14 (AsyncTask #1)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)

"CookieSyncManager" prio=5 tid=13 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41848f90 self=0x1a91248
| sysTid=2663 nice=10 sched=0/0 cgrp=bg_non_interactive handle=27888536
| schedstat=( 3302152 6325925 8 ) utm=0 stm=0 core=1
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:122)
at android.os.Looper.loop(Looper.java:135)
at android.webkit.WebSyncManager.run(WebSyncManager.java:90)
at android.webkit.CookieSyncManager.run(CookieSyncManager.java:61)
at java.lang.Thread.run(Thread.java:856)

"WebViewCoreThread" prio=5 tid=11 WAIT
| group="main" sCount=1 dsCount=0 obj=0x41888dc8 self=0x1a8e838
| sysTid=2661 nice=0 sched=0/0 cgrp=default handle=27846328
| schedstat=( 313471591 130332562 1238 ) utm=23 stm=8 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x41987fe8> (a android.webkit.CallbackProxy)
at java.lang.Object.wait(Object.java:364)
at android.webkit.CallbackProxy.shouldOverrideUrlLoading(CallbackProxy.java:1001)
at android.webkit.BrowserFrame.handleUrl(BrowserFrame.java:654)
at android.webkit.JWebCoreJavaBridge.nativeServiceFuncPtrQueue(Native Method)
at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:113)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:738)
at java.lang.Thread.run(Thread.java:856)

"Binder Thread #3" prio=5 tid=10 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41456440 self=0x1a28a50
| sysTid=2654 nice=0 sched=0/0 cgrp=default handle=27429392
| schedstat=( 1705920 9067694 8 ) utm=0 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #2" prio=5 tid=9 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41455b48 self=0x1a27af0
| sysTid=2653 nice=0 sched=0/0 cgrp=default handle=27416912
| schedstat=( 1736770 15136000 10 ) utm=0 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=8 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41452350 self=0x1a25040
| sysTid=2652 nice=0 sched=0/0 cgrp=default handle=27413984
| schedstat=( 7733459 8833156 18 ) utm=0 stm=0 core=1
at dalvik.system.NativeStart.run(Native Method)

"FinalizerWatchdogDaemon" daemon prio=5 tid=7 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x4143ad08 self=0x1a247d8
| sysTid=2651 nice=0 sched=0/0 cgrp=default handle=26970456
| schedstat=( 239845 2467077 4 ) utm=0 stm=0 core=0
at java.lang.VMThread.sleep(Native Method)
at java.lang.Thread.sleep(Thread.java:1031)
at java.lang.Thread.sleep(Thread.java:1013)
at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:213)
at java.lang.Thread.run(Thread.java:856)

"FinalizerDaemon" daemon prio=5 tid=6 WAIT
| group="main" sCount=1 dsCount=0 obj=0x4143abb0 self=0x1a24388
| sysTid=2650 nice=0 sched=0/0 cgrp=default handle=26968904
| schedstat=( 1796155 2710308 9 ) utm=0 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x40cd85d0> (a java.lang.ref.ReferenceQueue)
at java.lang.Object.wait(Object.java:401)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
at java.lang.Thread.run(Thread.java:856)

"ReferenceQueueDaemon" daemon prio=5 tid=5 WAIT
| group="main" sCount=1 dsCount=0 obj=0x4143aa48 self=0x1a23f38
| sysTid=2649 nice=0 sched=0/0 cgrp=default handle=27400544
| schedstat=( 958695 2574075 22 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x40cd84f8> 
at java.lang.Object.wait(Object.java:364)
at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:128)
at java.lang.Thread.run(Thread.java:8...
4

3 に答える 3

2

UIスレッドで長い(または場合によっては長くなる可能性のある)操作を実行しないでください。

これには、DB 操作、インターネット操作、複雑な計算、大容量ストレージ操作 (大きなファイルの書き込みなど) などが含まれます。

これらの各操作は、 asyncTask 、新しいスレッド、 thread を持つサービス、intentService、syncAdapter、スレッド プールなどで実行できます。

操作が終了したら、Handler オブジェクトを使用して UI にすべてが終了したことを伝えることができます。

于 2013-07-10T10:18:23.723 に答える
1

通常、ANR は、アプリケーションがユーザー入力に応答できない場合に発生します。最も一般的なケースは、メイン UI スレッドでヒーブ タスクを実行する場合です。そのタスクはワークフローをブロックし、ANR を作成します。

これを解決するには、UI スレッドではなく別のスレッドを使用して重いタスクを実行する必要があります。別のワーカー スレッド、AsyncTask、または Runnable をハンドラーに投稿して、タスクを実行できます。

ANR の詳細を知り、この問題を解決するには、この素晴らしい記事を確認してください

于 2013-07-10T07:21:36.690 に答える