I get an ANR-error in my Android app. The trace shows only one thread in blocked state (all the others are in state waiting, sleeping, native,..), so it doesn\'t seem to be in d
Have you tried to set android:largeHeap="true"
in application Manifest?
`
Trying to put more information on this issue. So that it can help future user's.
As you said only one thread in Blocked state, it's clear that it is not a Deadlock. Threads marked as blocked will generally tell you what mutex (lock) they are trying to acquire and the thread ID (tid) of the thread holding that lock.
In this particular case
- waiting to lock an unknown object
Above line tell neither what mutex(lock) it trying to acquire or thread ID holding that lock. (Maybe HeapTaskDaemon thread trying to lock some native object and in that attempt block due to some race condition). So just check with below information and identify the issue in your case and/or put forward an educated guess to prevent it.
On recent versions of Android, garbage collection(GC) generally runs on a background thread named HeapTaskDaemon. Note that significant amounts of allocation can mean more CPU resources spent on GC.
Systrace will show you if GC is running frequently, and the Android Memory Profiler can show you where allocations are coming from. If you avoid allocations when you can, especially in tight loops, you shouldn't have a problem.
check this for more information.
For more information on ANR and Deadlock's in Android check this link.
Hope this will help.
Seems like your SurfaceView is locking thread with ReentrantLock, but possibly having a problem initialising after setting WaitLock, and the ReentrantLock stays locked by SurfaceView, this is causing your Thread blocked usually know as Jank.
You sholud try debugging issue yourself, use Systrace to find what is causing Jank, also enable GPU rendering and Paste Systrace data here so that i can review, and provide any solution if possible.