Facing a high ANR rate in android 13 devices

678 Views Asked by At

enter image description here

I have a critical issue in my Android application. I am facing a high ANR (Application Not Responding) rate, which is occurring exclusively on Android version 13 devices. Despite exhaustive attempts, I have been unable to reproduce the ANR consistently or determine its root cause.

I'm getting this stack trace from Firebase crashlytics

    main (native):tid=1 systid=13180 
    #00 pc 0x501b0 libc.so (syscall + 32) (BuildId: 8cdfaa872c9e7191f6ce7a82d62dbc4b)
    #01 pc 0x54e7c libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*) + 148) (BuildId: 8cdfaa872c9e7191f6ce7a82d62dbc4b)
    #02 pc 0xbb2bc libc.so (pthread_cond_wait + 80) (BuildId: 8cdfaa872c9e7191f6ce7a82d62dbc4b)
    #03 pc 0x284f3c libhwui.so (android::uirenderer::renderthread::DrawFrameTask::drawFrame() + 360) (BuildId: 56d31f3aab59c6c0ed6699bc4a8c8848)
           at android.graphics.HardwareRenderer.nSyncAndDrawFrame(Native method)
           at android.graphics.HardwareRenderer.syncAndDrawFrame(HardwareRenderer.java:457)
           at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:866)
           at android.view.ViewRootImpl.draw(ViewRootImpl.java:5120)
           at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4819)
           at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4014)
           at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2606)
           at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9773)
           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1480)
           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1488)
           at android.view.Choreographer.doCallbacks(Choreographer.java:1111)
           at android.view.Choreographer.doFrame(Choreographer.java:1016)
           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1463)
           at android.os.Handler.handleCallback(Handler.java:942)
           at android.os.Handler.dispatchMessage(Handler.java:99)
           at android.os.Looper.loopOnce(Looper.java:223)
           at android.os.Looper.loop(Looper.java:324)
           at android.app.ActivityThread.main(ActivityThread.java:8631)
           at java.lang.reflect.Method.invoke(Native method)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1061)

I have optimized my code, updated all dependencies using the project, also upgrade AGP to v7.4.2. But nothing works.

1

There are 1 best solutions below

2
Bokili Production On

You have to be a little more specific. Do you use Google ads in the app and what formats (banner, interstitial...)? Do you use animations in the app, like ViewCompat.animate(View) or similar, and do you use hardware acceleration, like View.LAYER_TYPE_HARDWARE, ViewPropertyAnimator.withLayer(), etc.? Are you using some audio player in combination with one of these instances?

I have the same problems only on API 33 and I am currently working on a solution. Due to the content of these ARNs, it is impossible to know precisely what causes this very unpleasant event for users. If I find the reasons, I will write here, and you answer the above questions. Thank you. Greetings.