Android Question What is ANR ?

vbmundo

Well-Known Member
Licensed User
My App show today an ANR

and this Detail

B4X:
Último informe
Hoy, 12:40
Informes de esta semana
1
Informes totales
1
Versión de la aplicación
18
1
Versión de Android
Android 6.0
1
Dispositivo
P9 (HWEVA) 1

----- pid 20686 at 2016-08-24 17:37:43 -----
Cmd line: zetoox.mysql
Build fingerprint: 'HUAWEI/EVA-L09/HWEVA:6.0/HUAWEIEVA-L09/C40B131:user/release-keys'
ABI: 'arm64'
Build type: optimized
Zygote loaded classes=4078 post zygote classes=754
Intern table: 58835 strong; 171 weak
JNI: CheckJNI is off; globals=350 (plus 366 weak)
Libraries: /system/lib64/libandroid.so /system/lib64/libcompiler_rt.so /system/lib64/libfm_jni.so /system/lib64/libhwdeviceinfo.so /system/lib64/libhwtheme_jni.so /system/lib64/libjavacrypto.so /system/lib64/libjnigraphics.so /system/lib64/libmedia_jni.so /system/lib64/libwebviewchromium_loader.so libjavacore.so (10)
Heap: 17% free, 17MB/21MB; 54138 objects
Dumping cumulative Gc timings
Start Dumping histograms for 2 iterations for concurrent mark sweep
ProcessMarkStack:    Sum: 46.709ms 99% C.I. 0.004ms-32.236ms Avg: 7.784ms Max: 32.413ms
MarkConcurrentRoots:    Sum: 12.372ms 99% C.I. 0.004ms-9.754ms Avg: 3.093ms Max: 9.825ms
UpdateAndMarkImageModUnionTable:    Sum: 11.386ms 99% C.I. 3.581ms-7.805ms Avg: 5.693ms Max: 7.805ms
MarkRootsCheckpoint:    Sum: 9.900ms 99% C.I. 0.200ms-8.150ms Avg: 2.475ms Max: 8.276ms
SweepMallocSpace:    Sum: 5.921ms 99% C.I. 0.018ms-4.150ms Avg: 1.480ms Max: 4.179ms
MarkAllocStackAsLive:    Sum: 1.450ms 99% C.I. 392us-1058us Avg: 725us Max: 1058us
ScanGrayAllocSpaceObjects:    Sum: 657us 99% C.I. 0.500us-514us Avg: 164.250us Max: 514us
ReMarkRoots:    Sum: 636us 99% C.I. 78us-558us Avg: 318us Max: 558us
SweepSystemWeaks:    Sum: 522us 99% C.I. 137us-385us Avg: 261us Max: 385us
ImageModUnionClearCards:    Sum: 350us 99% C.I. 24us-186us Avg: 87.500us Max: 186us
AllocSpaceClearCards:    Sum: 339us 99% C.I. 0.333us-227us Avg: 42.375us Max: 227us
SweepLargeObjects:    Sum: 224us 99% C.I. 23us-201us Avg: 112us Max: 201us
MarkNonThreadRoots:    Sum: 198us 99% C.I. 15us-105us Avg: 49.500us Max: 105us
EnqueueFinalizerReferences:    Sum: 190us 99% C.I. 26us-164us Avg: 95us Max: 164us
SweepZygoteSpace:    Sum: 121us 99% C.I. 49us-72us Avg: 60.500us Max: 72us
ZygoteModUnionClearCards:    Sum: 88us 99% C.I. 8us-34us Avg: 22us Max: 34us
ScanGrayImageSpaceObjects:    Sum: 53us 99% C.I. 12us-41us Avg: 26.500us Max: 41us
ScanGrayZygoteSpaceObjects:    Sum: 50us 99% C.I. 15us-35us Avg: 25us Max: 35us
(Paused)ScanGrayImageSpaceObjects:    Sum: 44us 99% C.I. 10us-34us Avg: 22us Max: 34us
(Paused)ScanGrayAllocSpaceObjects:    Sum: 39us 99% C.I. 0.250us-32us Avg: 9.750us Max: 32us
RevokeAllThreadLocalAllocationStacks:    Sum: 37us 99% C.I. 6us-31us Avg: 18.500us Max: 31us
(Paused)ScopedPause:    Sum: 34us 99% C.I. 7us-27us Avg: 17us Max: 27us
(Paused)PausePhase:    Sum: 27us 99% C.I. 9us-18us Avg: 13.500us Max: 18us
ProcessReferences:    Sum: 26us 99% C.I. 4us-22us Avg: 13us Max: 22us
MarkingPhase:    Sum: 24us 99% C.I. 10us-14us Avg: 12us Max: 14us
SwapBitmaps:    Sum: 23us 99% C.I. 5us-18us Avg: 11.500us Max: 18us
InitializePhase:    Sum: 21us 99% C.I. 3us-18us Avg: 10.500us Max: 18us
ProcessCards:    Sum: 18us 99% C.I. 2us-7us Avg: 4.500us Max: 7us
PreCleanCards:    Sum: 16us 99% C.I. 3us-13us Avg: 8us Max: 13us
Sweep:    Sum: 13us 99% C.I. 3us-10us Avg: 6.500us Max: 10us
ReclaimPhase:    Sum: 12us 99% C.I. 3us-9us Avg: 6us Max: 9us
BindBitmaps:    Sum: 10us 99% C.I. 5us-5us Avg: 5us Max: 5us
(Paused)ScanGrayZygoteSpaceObjects:    Sum: 7us 99% C.I. 1us-6us Avg: 3.500us Max: 6us
RecursiveMark:    Sum: 5us 99% C.I. 1us-4us Avg: 2.500us Max: 4us
FindDefaultSpaceBitmap:    Sum: 1us 99% C.I. 250ns-1000ns Avg: 500ns Max: 1000ns
(Paused)ProcessMarkStack:    Sum: 0 99% C.I. 0ns-0ns Avg: 0ns Max: 0ns
Done Dumping histograms
concurrent mark sweep paused:    Sum: 839us 99% C.I. 133us-706us Avg: 419.500us Max: 706us
concurrent mark sweep total time: 91.722ms mean time: 45.861ms
concurrent mark sweep freed: 52435 objects with total size 4MB
concurrent mark sweep throughput: 576209/s / 51MB/s
Total time spent in GC: 91.722ms
Mean GC size throughput: 47MB/s
Mean GC object throughput: 571553 objects/s
Total number of allocations 106562
Total bytes allocated 22MB
Total bytes freed 4MB
Free memory 3MB
Free memory until GC 3MB
Free memory until OOME 366MB
Total memory 21MB
Max memory 384MB
Zygote space size 1568KB
Total mutator paused time: 839us
Total time waiting for GC to complete: 5.730us
Total GC count: 2
Total GC time: 91.722ms
Total blocking GC count: 0
Total blocking GC time: 0
Histogram of GC count per 10000 ms: 0:31,1:1
Histogram of blocking GC count per 10000 ms: 0:32

The original detail is too much long...

What I need to know about this report ?

Regards

Edit by Erel: Explanation about ANR.
 
Last edited by a moderator:

vbmundo

Well-Known Member
Licensed User
This will not help. Service code is also executed on the main thread.

Making network calls on the main thread will eventually lead to ANR errors. You can use the Threading library to make the calls in the background however it can cause other errors.

What About using a .BAS file instead a Service File ?
 
Upvote 0

vbmundo

Well-Known Member
Licensed User
In my personal case:
Capture1.png
Capture2.png
As you can see, my game is now ANR safe. You won't be able to implement the same solution as me, but to my knowledge, your alternatives are:
- ProBundle CallSubExtended (paid)
- Threading library

Thanks Friend

But in my APP some operations depends from others.. I can't do anything Async... I need to Connect to a Host Server, to load the Databases, to Show the Tables, etc.

Is a MySQL Manager for Android..

I have too much good comments to this APP.

My APP has begun in the post 250 and today (at a month of life) is ranked 9th

I will learn too much about Main Thread.

Thanks !!
 
Upvote 0

vbmundo

Well-Known Member
Licensed User
Then Friends,

What can I do ?

Can you remake your Lib DonManfred ?
Can you include an Error Management in the Wrong Connection Credentials ?

I'm sure that the ANR is for this missing feature.

Regards
 
Upvote 0
Top