gpt4 book ai didi

android - 是什么导致了ANR?

转载 作者:行者123 更新时间:2023-11-29 14:13:44 24 4
gpt4 key购买 nike

微信APP出现ANR。跟踪文件中有很多关于内存的信息。是内存力不足造成的吗?是否所有 ANR 痕迹都包含有关内存的信息?如何解释跟踪文件?部分跟踪文件如下。

----- pid 2991 at 2016-03-03 18:30:34 -----
Cmd line: com.tencent.mm
ABI: arm
Build type: optimized
Zygote loaded classes=3631 post zygote classes=6053
Intern table: 51739 strong; 613 weak
JNI: CheckJNI is off; globals=572
Libraries: /data/app-lib/TencentWeiXin/libFFmpeg.so /data/app-lib/TencentWeiXin/libMMProtocalJni.so /data/app-lib/TencentWeiXin/libkkdb.so /data/app-lib/TencentWeiXin/libstlport_shared.so /data/app-lib/TencentWeiXin/libtencentloc.so /data/app-lib/TencentWeiXin/libtenpay_utils.so /data/app-lib/TencentWeiXin/libvoipMain.so /data/app-lib/TencentWeiXin/libwechatBankCardRecog.so /data/app-lib/TencentWeiXin/libwechatCrashForJni.so /data/app-lib/TencentWeiXin/libwechatcommon.so /data/app-lib/TencentWeiXin/libwechatmm.so /data/app-lib/TencentWeiXin/libwechatpack.so /data/app-lib/TencentWeiXin/libwechatsight_v7a.so /data/app-lib/TencentWeiXin/libwechatvoicereco.so /data/app-lib/TencentWeiXin/libwechatvoicesilk_v7a.so /data/app-lib/TencentWeiXin/libwechatxlog.so /system/lib/libandroid.so /system/lib/libaudioeffect_jni.so /system/lib/libcompiler_rt.so /system/lib/libjavacrypto.so /system/lib/libjnigraphics.so /system/lib/libmedia_jni.so /system/lib/librs_jni.so /system/lib/libsoundpool.so /system/lib/libvivo_runtime.so /system/lib/libwebviewchromium_loader.so libjavacore.so (27)
Heap: 8% free, 33MB/36MB; 361666 objects
Dumping cumulative Gc timings
Start Dumping histograms for 40 iterations for concurrent mark sweep
ProcessMarkStack: Sum: 172.446ms 99% C.I. 0.001ms-11.079ms Avg: 1.437ms Max: 11.729ms
UpdateAndMarkImageModUnionTable: Sum: 79.472ms 99% C.I. 0.335ms-10.720ms Avg: 1.986ms Max: 12.154ms
MarkConcurrentRoots: Sum: 58.064ms 99% C.I. 4us-1859.999us Avg: 725.800us Max: 1869us
SweepMallocSpace: Sum: 17.739ms 99% C.I. 2us-1454us Avg: 221.737us Max: 1454us
MarkRootsCheckpoint: Sum: 13.082ms 99% C.I. 42us-2229.999us Avg: 163.525us Max: 3344us
ImageModUnionClearCards: Sum: 8.244ms 99% C.I. 95us-159us Avg: 103.050us Max: 159us
ScanGrayAllocSpaceObjects: Sum: 3.958ms 99% C.I. 0.338us-380us Avg: 49.475us Max: 388us
ScanGrayImageSpaceObjects: Sum: 3.952ms 99% C.I. 92us-222us Avg: 98.800us Max: 222us
AllocSpaceClearCards: Sum: 3.868ms 99% C.I. 0.296us-109.999us Avg: 24.175us Max: 118us
(Paused)ScanGrayImageSpaceObjects: Sum: 3.772ms 99% C.I. 92us-140us Avg: 94.300us Max: 146us
MarkAllocStackAsLive: Sum: 3.151ms 99% C.I. 26us-335us Avg: 78.775us Max: 336us
FinishPhase: Sum: 2.332ms 99% C.I. 21us-160us Avg: 58.300us Max: 160us
ReMarkRoots: Sum: 2.219ms 99% C.I. 29us-142us Avg: 55.475us Max: 142us
MarkNonThreadRoots: Sum: 2.190ms 99% C.I. 12us-214us Avg: 27.375us Max: 214us
(Paused)ScanGrayAllocSpaceObjects: Sum: 2.035ms 99% C.I. 0.294us-140us Avg: 25.437us Max: 148us
SweepSystemWeaks: Sum: 1.604ms 99% C.I. 7us-172us Avg: 40.100us Max: 172us
EnqueueFinalizerReferences: Sum: 795us 99% C.I. 2us-213us Avg: 19.875us Max: 213us
ZygoteModUnionClearCards: Sum: 685us 99% C.I. 70us-266us Avg: 114.166us Max: 266us
SweepZygoteSpace: Sum: 498us 99% C.I. 152us-193us Avg: 166us Max: 193us
ScanGrayZygoteSpaceObjects: Sum: 450us 99% C.I. 149us-151us Avg: 150us Max: 151us
SwapBitmaps: Sum: 448us 99% C.I. 8us-44us Avg: 11.200us Max: 44us
MarkingPhase: Sum: 394us 99% C.I. 7us-19us Avg: 9.850us Max: 19us
PreCleanCards: Sum: 356us 99% C.I. 6us-13us Avg: 8.900us Max: 13us
(Paused)PausePhase: Sum: 329us 99% C.I. 7us-11us Avg: 8.225us Max: 11us
RevokeAllThreadLocalAllocationStacks: Sum: 287us 99% C.I. 4us-48us Avg: 7.175us Max: 48us
ProcessCards: Sum: 276us 99% C.I. 2us-6us Avg: 3.450us Max: 6us
ReclaimPhase: Sum: 186us 99% C.I. 4us-7us Avg: 4.650us Max: 7us
(Paused)ScanGrayZygoteSpaceObjects: Sum: 182us 99% C.I. 60us-61us Avg: 60.666us Max: 61us
Sweep: Sum: 169us 99% C.I. 3us-7us Avg: 4.225us Max: 7us
MarkRoots: Sum: 149us 99% C.I. 2us-7us Avg: 3.725us Max: 7us
ProcessReferences: Sum: 138us 99% C.I. 2us-6us Avg: 3.450us Max: 6us
RecursiveMark: Sum: 116us 99% C.I. 1us-4us Avg: 2.900us Max: 4us
SweepLargeObjects: Sum: 100us 99% C.I. 0.256us-87us Avg: 2.500us Max: 87us
BindBitmaps: Sum: 70us 99% C.I. 1us-3us Avg: 1.750us Max: 3us
InitializePhase: Sum: 68us 99% C.I. 1us-6us Avg: 1.700us Max: 6us
SwapStacks: Sum: 40us 99% C.I. 1us-1us Avg: 1us Max: 1us
FindDefaultSpaceBitmap: Sum: 4us 99% C.I. 250ns-1000ns Avg: 100ns Max: 1000ns
UnBindBitmaps: Sum: 3us 99% C.I. 250ns-1000ns Avg: 75ns Max: 1000ns
(Paused)ProcessMarkStack: Sum: 2us 99% C.I. 250ns-2000ns Avg: 50ns Max: 2000ns
PreSweepingGcVerification: Sum: 0 99% C.I. 0ns-0ns Avg: 0ns Max: 0ns
Done Dumping histograms
concurrent mark sweep paused: Sum: 9.376ms 99% C.I. 171us-528us Avg: 234.400us Max: 528us
concurrent mark sweep total time: 383.873ms mean time: 9.596ms
concurrent mark sweep freed: 56087 objects with total size 41MB
concurrent mark sweep throughput: 146441/s / 108MB/s
Start Dumping histograms for 29 iterations for partial concurrent mark sweep
ProcessMarkStack: Sum: 1.653s 99% C.I. 0.012ms-94.816ms Avg: 19.010ms Max: 97.335ms
SweepMallocSpace: Sum: 551.113ms 99% C.I. 0.016ms-33.060ms Avg: 9.501ms Max: 33.060ms
SweepLargeObjects: Sum: 139.476ms 99% C.I. 0.067ms-45.447ms Avg: 4.809ms Max: 47.874ms
MarkRootsCheckpoint: Sum: 105.856ms 99% C.I. 0.439ms-15.454ms Avg: 1.825ms Max: 17.481ms
MarkConcurrentRoots: Sum: 84.698ms 99% C.I. 0.002ms-7.810ms Avg: 1.460ms Max: 8.097ms
ScanGrayAllocSpaceObjects: Sum: 59.117ms 99% C.I. 0.005ms-5.284ms Avg: 1.019ms Max: 5.329ms
UpdateAndMarkImageModUnionTable: Sum: 55.007ms 99% C.I. 0.465ms-6.524ms Avg: 1.896ms Max: 6.703ms
AllocSpaceClearCards: Sum: 25.765ms 99% C.I. 6us-1238.999us Avg: 222.112us Max: 1453us
ReMarkRoots: Sum: 25.066ms 99% C.I. 255us-4173.749us Avg: 864.344us Max: 4461us
(Paused)ScanGrayObjects: Sum: 19.561ms 99% C.I. 336us-1817us Avg: 752.346us Max: 1817us
MarkAllocStackAsLive: Sum: 18.329ms 99% C.I. 34us-3822.999us Avg: 632.034us Max: 4167us
EnqueueFinalizerReferences: Sum: 13.880ms 99% C.I. 29us-1263.750us Avg: 478.620us Max: 1273us
MarkNonThreadRoots: Sum: 12.893ms 99% C.I. 29us-3445.500us Avg: 222.293us Max: 3726us
FinishPhase: Sum: 9.710ms 99% C.I. 107us-934.749us Avg: 334.827us Max: 955us
UpdateAndMarkZygoteModUnionTable: Sum: 7.671ms 99% C.I. 128us-435us Avg: 264.517us Max: 435us
ImageModUnionClearCards: Sum: 5.647ms 99% C.I. 43us-269us Avg: 97.362us Max: 269us
ZygoteModUnionClearCards: Sum: 3.371ms 99% C.I. 24us-130us Avg: 58.120us Max: 130us
SweepSystemWeaks: Sum: 3.274ms 99% C.I. 53us-351us Avg: 112.896us Max: 351us
ScanGrayImageSpaceObjects: Sum: 2.333ms 99% C.I. 33us-323us Avg: 80.448us Max: 323us
RevokeAllThreadLocalAllocationStacks: Sum: 1.555ms 99% C.I. 22us-109us Avg: 53.620us Max: 109us
ScanGrayZygoteSpaceObjects: Sum: 1.179ms 99% C.I. 20us-92us Avg: 40.655us Max: 92us
ProcessReferences: Sum: 1.049ms 99% C.I. 7us-97us Avg: 36.172us Max: 97us
(Paused)ScanGrayAllocSpaceObjects: Sum: 700us 99% C.I. 7us-316us Avg: 116.666us Max: 316us
MarkingPhase: Sum: 455us 99% C.I. 10us-22us Avg: 15.689us Max: 22us
PreCleanCards: Sum: 324us 99% C.I. 7us-28us Avg: 11.172us Max: 28us
ProcessCards: Sum: 306us 99% C.I. 3us-13us Avg: 5.275us Max: 13us
SwapBitmaps: Sum: 285us 99% C.I. 4us-23us Avg: 9.827us Max: 23us
(Paused)PausePhase: Sum: 268us 99% C.I. 5us-16us Avg: 9.241us Max: 16us
ReclaimPhase: Sum: 196us 99% C.I. 4us-11us Avg: 6.758us Max: 11us
Sweep: Sum: 188us 99% C.I. 4us-13us Avg: 6.482us Max: 13us
MarkRoots: Sum: 159us 99% C.I. 2us-9us Avg: 5.482us Max: 9us
(Paused)ScanGrayImageSpaceObjects: Sum: 110us 99% C.I. 31us-46us Avg: 36.666us Max: 46us
(Paused)ScanGrayZygoteSpaceObjects: Sum: 67us 99% C.I. 20us-26us Avg: 22.333us Max: 26us
RecursiveMark: Sum: 61us 99% C.I. 1us-4us Avg: 2.103us Max: 4us
BindBitmaps: Sum: 58us 99% C.I. 0.250us-4us Avg: 2us Max: 4us
(Paused)ProcessMarkStack: Sum: 41us 99% C.I. 0.250us-28us Avg: 1.413us Max: 28us
SwapStacks: Sum: 34us 99% C.I. 0.250us-2us Avg: 1.172us Max: 2us
UnBindBitmaps: Sum: 19us 99% C.I. 250ns-2000ns Avg: 655ns Max: 2000ns
SweepZygoteSpace: Sum: 14us 99% C.I. 250ns-2000ns Avg: 482ns Max: 2000ns
FindDefaultSpaceBitmap: Sum: 12us 99% C.I. 250ns-1000ns Avg: 413ns Max: 1000ns
PreSweepingGcVerification: Sum: 0 99% C.I. 0ns-0ns Avg: 0ns Max: 0ns
Done Dumping histograms
partial concurrent mark sweep paused: Sum: 50.579ms 99% C.I. 0.745ms-5.637ms Avg: 1.744ms Max: 5.809ms
partial concurrent mark sweep total time: 2.803s mean time: 96.682ms
partial concurrent mark sweep freed: 2849442 objects with total size 350MB
partial concurrent mark sweep throughput: 1.01657e+06/s / 125MB/s
Start Dumping histograms for 433 iterations for sticky concurrent mark sweep
FreeList: Sum: 3.351s 99% C.I. 2.355us-1797.142us Avg: 283.098us Max: 32359us
ScanGrayAllocSpaceObjects: Sum: 3.108s 99% C.I. 0.003ms-12.536ms Avg: 1.794ms Max: 20.174ms
MarkRootsCheckpoint: Sum: 1.140s 99% C.I. 0.109ms-7.736ms Avg: 1.317ms Max: 42.567ms
MarkConcurrentRoots: Sum: 945.400ms 99% C.I. 0.002ms-3.916ms Avg: 1.091ms Max: 4.099ms
SweepArray: Sum: 647.153ms 99% C.I. 0.043ms-22.408ms Avg: 1.494ms Max: 50.451ms
ProcessMarkStack: Sum: 561.381ms 99% C.I. 0.983us-3675us Avg: 325.438us Max: 5955us
AllocSpaceClearCards: Sum: 428.579ms 99% C.I. 4us-1039us Avg: 247.447us Max: 1716us
ReMarkRoots: Sum: 383.415ms 99% C.I. 102.062us-2358.750us Avg: 885.484us Max: 3753us
(Paused)ScanGrayObjects: Sum: 239.692ms 99% C.I. 217us-2382.999us Avg: 735.251us Max: 3116us
MarkingPhase: Sum: 221.521ms 99% C.I. 147us-5736us Avg: 511.595us Max: 35912us
EnqueueFinalizerReferences: Sum: 177.317ms 99% C.I. 15.464us-1475.250us Avg: 409.508us Max: 2108us
ScanGrayImageSpaceObjects: Sum: 119.937ms 99% C.I. 32us-1550.249us Avg: 138.495us Max: 3102us
ImageModUnionClearCards: Sum: 95.133ms 99% C.I. 39us-294.500us Avg: 109.853us Max: 651us
ZygoteModUnionClearCards: Sum: 59.226ms 99% C.I. 24us-228.999us Avg: 69.514us Max: 1214us
MarkNonThreadRoots: Sum: 56.749ms 99% C.I. 19us-195.875us Avg: 65.530us Max: 687us
ScanGrayZygoteSpaceObjects: Sum: 54.831ms 99% C.I. 20us-159.250us Avg: 64.355us Max: 310us
SweepSystemWeaks: Sum: 47.955ms 99% C.I. 31us-280.583us Avg: 110.750us Max: 377us
(Paused)ScanGrayAllocSpaceObjects: Sum: 42.269ms 99% C.I. 7us-1048.249us Avg: 197.518us Max: 1551us
FinishPhase: Sum: 38.872ms 99% C.I. 18us-567us Avg: 89.773us Max: 2228us
ResetStack: Sum: 38.069ms 99% C.I. 16us-345.875us Avg: 87.919us Max: 476us
RevokeAllThreadLocalAllocationStacks: Sum: 29.635ms 99% C.I. 6us-197.250us Avg: 68.441us Max: 260us
(Paused)ScanGrayImageSpaceObjects: Sum: 10.396ms 99% C.I. 31us-218us Avg: 97.158us Max: 218us
(Paused)ScanGrayZygoteSpaceObjects: Sum: 6.266ms 99% C.I. 20us-225us Avg: 62.660us Max: 246us
ProcessCards: Sum: 5.164ms 99% C.I. 2us-37us Avg: 5.963us Max: 37us
(Paused)PausePhase: Sum: 5.134ms 99% C.I. 5us-49.865us Avg: 11.856us Max: 64us
PreCleanCards: Sum: 5.130ms 99% C.I. 5us-29us Avg: 11.847us Max: 29us
ReclaimPhase: Sum: 3.701ms 99% C.I. 4us-49.865us Avg: 8.547us Max: 220us
SwapBitmaps: Sum: 2.857ms 99% C.I. 2us-49.980us Avg: 6.598us Max: 87us
ProcessReferences: Sum: 2.633ms 99% C.I. 2us-49.865us Avg: 6.080us Max: 210us
MarkRoots: Sum: 1.962ms 99% C.I. 2us-32us Avg: 4.531us Max: 32us
(Paused)ProcessMarkStack: Sum: 1.596ms 99% C.I. 0.250us-49.865us Avg: 3.685us Max: 891us
BindBitmaps: Sum: 923us 99% C.I. 1us-9us Avg: 2.131us Max: 9us
InitializePhase: Sum: 904us 99% C.I. 0.250us-8us Avg: 2.087us Max: 8us
UnBindBitmaps: Sum: 803us 99% C.I. 1us-13us Avg: 1.854us Max: 13us
SwapStacks: Sum: 654us 99% C.I. 0.250us-5us Avg: 1.510us Max: 5us
ForwardSoftReferences: Sum: 516us 99% C.I. 0.250us-3us Avg: 1.211us Max: 3us
FindDefaultSpaceBitmap: Sum: 461us 99% C.I. 0.250us-35us Avg: 1.064us Max: 35us
RecordFree: Sum: 371us 99% C.I. 250ns-5000ns Avg: 856ns Max: 5000ns
PreSweepingGcVerification: Sum: 11us 99% C.I. 250ns-2000ns Avg: 25ns Max: 2000ns
Done Dumping histograms
sticky concurrent mark sweep paused: Sum: 750.653ms 99% C.I. 0.344ms-4.458ms Avg: 1.733ms Max: 4.925ms
sticky concurrent mark sweep total time: 11.837s mean time: 27.338ms
sticky concurrent mark sweep freed: 11880178 objects with total size 2GB
sticky concurrent mark sweep throughput: 1.00365e+06/s / 225MB/s
Start Dumping histograms for 8 iterations for marksweep + semispace
ProcessMarkStack: Sum: 882.200ms 99% C.I. 0.116ms-197.248ms Avg: 55.137ms Max: 200.566ms
MarkRoots: Sum: 482.324ms 99% C.I. 9.767ms-363.776ms Avg: 60.290ms Max: 374.407ms
ClearCardTable: Sum: 116.105ms 99% C.I. 3.815ms-22.688ms Avg: 14.513ms Max: 22.754ms
UpdateAndMarkImageModUnionTable: Sum: 85.806ms 99% C.I. 0.969ms-69.440ms Avg: 10.725ms Max: 71.365ms
UpdateAndMarkZygoteModUnionTable: Sum: 9.301ms 99% C.I. 0.360ms-6.168ms Avg: 1.162ms Max: 6.351ms
(Paused)ProcessReferences: Sum: 5.782ms 99% C.I. 11us-1200us Avg: 722.750us Max: 1200us
MarkStackAsLive: Sum: 3.959ms 99% C.I. 51us-1220us Avg: 494.875us Max: 1220us
AllocSpaceClearCards: Sum: 3.551ms 99% C.I. 6us-882us Avg: 147.958us Max: 892us
RevokeAllThreadLocalBuffers: Sum: 2.846ms 99% C.I. 55us-381us Avg: 177.875us Max: 381us
(Paused)EnqueueFinalizerReferences: Sum: 2.670ms 99% C.I. 94us-544us Avg: 333.750us Max: 544us
SweepLargeObjects: Sum: 1.668ms 99% C.I. 63us-641us Avg: 208.500us Max: 641us
ZygoteModUnionClearCards: Sum: 1.574ms 99% C.I. 50us-1014us Avg: 196.750us Max: 1020us
ImageModUnionClearCards: Sum: 1.112ms 99% C.I. 83us-245us Avg: 139us Max: 245us
SweepSystemWeaks: Sum: 748us 99% C.I. 80us-120us Avg: 93.500us Max: 120us
FinishPhase: Sum: 734us 99% C.I. 39us-114us Avg: 91.750us Max: 114us
RevokeAllThreadLocalAllocationStacks: Sum: 594us 99% C.I. 34us-225us Avg: 74.250us Max: 225us
SweepAllocSpace: Sum: 217us 99% C.I. 22us-32us Avg: 27.125us Max: 32us
MarkReachableObjects: Sum: 85us 99% C.I. 7us-16us Avg: 10.625us Max: 16us
ProcessCards: Sum: 66us 99% C.I. 7us-14us Avg: 8.250us Max: 14us
SwapBitmaps: Sum: 56us 99% C.I. 5us-14us Avg: 7us Max: 14us
MarkingPhase: Sum: 33us 99% C.I. 4us-5us Avg: 4.125us Max: 5us
BindBitmaps: Sum: 29us 99% C.I. 3us-5us Avg: 3.625us Max: 5us
ReclaimPhase: Sum: 21us 99% C.I. 2us-4us Avg: 2.625us Max: 4us
InitializePhase: Sum: 11us 99% C.I. 1us-3us Avg: 1.375us Max: 3us
SweepZygoteSpace: Sum: 6us 99% C.I. 250ns-1000ns Avg: 750ns Max: 1000ns
UnBindBitmaps: Sum: 5us 99% C.I. 250ns-1000ns Avg: 625ns Max: 1000ns
PreSweepingGcVerification: Sum: 4us 99% C.I. 250ns-2000ns Avg: 500ns Max: 2000ns
PostGcVerificationPaused: Sum: 0 99% C.I. 0ns-0ns Avg: 0ns Max: 0ns
Done Dumping histograms
marksweep + semispace paused: Sum: 1.602s 99% C.I. 54.291ms-744.167ms Avg: 200.299ms Max: 744.167ms
marksweep + semispace total time: 1.601s mean time: 200.192ms
marksweep + semispace freed: 405363 objects with total size 32MB
marksweep + semispace throughput: 253194/s / 20MB/s
Total time spent in GC: 16.626s
Mean GC size throughput: 175MB/s
Mean GC object throughput: 891340 objects/s
Total number of allocations 15181656
Total bytes allocated 2GB
Free memory 2MB
Free memory until GC 2MB
Free memory until OOME 734MB
Total memory 36MB
Max memory 768MB
Total mutator paused time: 2.413s
Total time waiting for GC to complete: 40.097ms

DALVIK THREADS (65):
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x74317000 self=0xaad86d18
| sysTid=2991 nice=0 cgrp=default sched=0/0 handle=0xf760fbec
| state=S schedstat=( 66942910787 6040590684 41109 ) utm=3367 stm=3327 core=6 HZ=100
| stack=0xff4e1000-0xff4e3000 stackSize=8MB
| held mutexes=
kernel: (couldn't read /proc/self/task/2991/stack)
native: #00 pc 0000f9c8 /system/lib/libc.so (syscall+28)
native: #01 pc 000a940b /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+82)
native: #02 pc 001c34bd /system/lib/libart.so (art::JNI::ReleaseByteArrayElements(_JNIEnv*, _jbyteArray*, signed char*, int)+976)
native: #03 pc 00015c05 /system/lib/libjavacore.so (???)
native: #04 pc 0001d441 /system/lib/libjavacore.so (???)
native: #05 pc 000202b9 /system/lib/libjavacore.so (???)
native: #06 pc 0027aa13 /system/framework/arm/boot.oat (Java_libcore_io_Posix_readBytes__Ljava_io_FileDescriptor_2Ljava_lang_Object_2II+142)
at libcore.io.Posix.readBytes(Native method)
at libcore.io.Posix.read(Posix.java:165)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:230)
at libcore.io.IoBridge.read(IoBridge.java:472)
at java.io.FileInputStream.read(FileInputStream.java:177)
at java.io.InputStreamReader.read(InputStreamReader.java:231)
- locked <@addr=0x140239a0> (a java.io.FileInputStream)
at java.io.BufferedReader.fillBuf(BufferedReader.java:145)
at java.io.BufferedReader.readLine(BufferedReader.java:397)
- locked <@addr=0x14023980> (a java.io.InputStreamReader)
at com.tencent.mm.sdk.platformtools.ah.aRq(SourceFile:230)
at com.tencent.mm.sdk.platformtools.ah.run(SourceFile:135)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.tencent.mm.sdk.platformtools.ad.dispatchMessage(SourceFile:117)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5386)
at java.lang.reflect.Method.invoke!(Native method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:927)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:722)

最佳答案

ANR 表示“应用程序无响应”。这意味着你阻塞了主线程超过 5 秒。为保持应用流畅和响应迅速,您不应阻塞主线程超过 16 毫秒。

ANR 转储的最后显示了问题:

"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x74317000 self=0xaad86d18
| sysTid=2991 nice=0 cgrp=default sched=0/0 handle=0xf760fbec
| state=S schedstat=( 66942910787 6040590684 41109 ) utm=3367 stm=3327 core=6 HZ=100
| stack=0xff4e1000-0xff4e3000 stackSize=8MB
| held mutexes=
kernel: (couldn't read /proc/self/task/2991/stack)
native: #00 pc 0000f9c8 /system/lib/libc.so (syscall+28)
native: #01 pc 000a940b /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+82)
native: #02 pc 001c34bd /system/lib/libart.so (art::JNI::ReleaseByteArrayElements(_JNIEnv*, _jbyteArray*, signed char*, int)+976)
native: #03 pc 00015c05 /system/lib/libjavacore.so (???)
native: #04 pc 0001d441 /system/lib/libjavacore.so (???)
native: #05 pc 000202b9 /system/lib/libjavacore.so (???)
native: #06 pc 0027aa13 /system/framework/arm/boot.oat (Java_libcore_io_Posix_readBytes__Ljava_io_FileDescriptor_2Ljava_lang_Object_2II+142)
at libcore.io.Posix.readBytes(Native method)
at libcore.io.Posix.read(Posix.java:165)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:230)
at libcore.io.IoBridge.read(IoBridge.java:472)
at java.io.FileInputStream.read(FileInputStream.java:177)
at java.io.InputStreamReader.read(InputStreamReader.java:231)
- locked <@addr=0x140239a0> (a java.io.FileInputStream)
at java.io.BufferedReader.fillBuf(BufferedReader.java:145)
at java.io.BufferedReader.readLine(BufferedReader.java:397)
- locked <@addr=0x14023980> (a java.io.InputStreamReader)
at com.tencent.mm.sdk.platformtools.ah.aRq(SourceFile:230)
at com.tencent.mm.sdk.platformtools.ah.run(SourceFile:135)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.tencent.mm.sdk.platformtools.ad.dispatchMessage(SourceFile:117)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5386)
at java.lang.reflect.Method.invoke!(Native method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:927)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:722)

你可以看到包com.tencent中的某些东西在读取一些InputStream时被阻塞了。应用程序不应该在主线程上读取或写入文件和网络 - 这都应该在不同的线程上完成。

关于android - 是什么导致了ANR?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35810789/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com