Home » Android » android – Waiting because no window has focus but there is a "focused application that may eventually add a window when it finishes starting up

android – Waiting because no window has focus but there is a "focused application that may eventually add a window when it finishes starting up

Posted by: admin May 14, 2020 Leave a comment

Questions:

Please help me to understand what is meaning of below ANR?
“Waiting because no window has focus but there is a “focused application that may eventually add a window when it finishes starting up.”

How to&Answers:

Well, I am facing the same issue and this is what I come up with.

The log you mentioned:
“Waiting because no window has focus but there is a “focused application that may eventually add a window when it finishes starting up.”

is dispatched by the InputDispatcher.cpp from AOSP framework.

It happens when InputDispatcher is waiting for application to add a window to inject input. If the time waiting > 5000ms, then you will have an ANR.

Answer:

I think this happens when an activity is started but somehow it doesn’t add any content view to interact with user. I also saw this error on developer console because there was an issue with app’s framework and it used to get stuck on splash screen. The reason was the activity doesn’t call setContentView by default but waits for the app framework to initialize, and when framework initialized completely it didn’t add any view to activity because of a bug.