title: Android ANR - Input dispatching timed out
body: <p>I have started receiving several strange ANR-report (Application Not Responding) from many code locations.</p>
  
  <blockquote>
    <p>Input dispatching timed out (Waiting because no window has focus but
    there is a focused application that may eventually add a window when
    it finishes starting up.)</p>
  </blockquote>
  
  <p>This ANR is popping up always in different places in my code, and they follow no logical pattern. I started receiving those errors around a month ago.</p>
  
  <p>There are some examples of ANR reports and his respective code line:</p>
  
  <pre><code>at android.support.v7.app.AppCompatActivity.setContentView (AppCompatActivity.java:139)
  at br.com.xxx.xxx.activities.MainActivity.onCreate (MainActivity.java:71)
  at android.app.Activity.performCreate (Activity.java:6245)
  
  MainActivity.java:71: setContentView(R.layout.activity_main);
  </code></pre>
  
  <p>Another example:</p>
  
  <pre><code>at android.support.v4.app.BackStackRecord.replace (BackStackRecord.java:421)
  at br.com.xxx.xxx.activities.MainActivity.openFragment (MainActivity.java:146)
  at br.com.xxx.xxx.activities.MainActivity.openMenu (MainActivity.java:121)
  
                         currentFragment = new CardsFragment();
  MainActivity.java:146: openFragment(currentFragment);
  </code></pre>
  
  <p>And that one doesn't even have a reference in to code:</p>
  
  <pre><code>  at java.lang.Object.wait! (Native method)
  - waiting on &lt;0x0a7b02dc&gt; (a java.lang.Object)
    at java.lang.Thread.parkFor$ (Thread.java:1220)
  - locked &lt;0x0a7b02dc&gt; (a java.lang.Object)
    at sun.misc.Unsafe.park (Unsafe.java:299)
    at java.util.concurrent.locks.LockSupport.park (LockSupport.java:158)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt (AbstractQueuedSynchronizer.java:810)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly (AbstractQueuedSynchronizer.java:971)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly (AbstractQueuedSynchronizer.java:1278)
    at java.util.concurrent.CountDownLatch.await (CountDownLatch.java:203)
    at android.app.SharedPreferencesImpl$EditorImpl$1.run (SharedPreferencesImpl.java:366)
    at android.app.QueuedWork.waitToFinish (QueuedWork.java:88)
    at android.app.ActivityThread.handleStopService (ActivityThread.java:3065)
    at android.app.ActivityThread.-wrap21 (ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1457)
    at android.os.Handler.dispatchMessage (Handler.java:102)
    at android.os.Looper.loop (Looper.java:148)
    at android.app.ActivityThread.main (ActivityThread.java:5443)
    at java.lang.reflect.Method.invoke! (Native method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:728)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:618)
  </code></pre>
  
  <p><strong>My question is:</strong> there is are a bunch of ANR reporting the same error but in different places and different applications. How do I resolve this error? Or I have to consider all those errors as different isolated errors?</p>
  
  <p>I know there are already questions with this theme, but no one has yet given a helpful answer. At least none that could help me.</p>
  
  <p><strong>Edit:</strong> I am receiving those errors from many devices and Android versions:</p>
  
  <ul>
  <li>Motorola Moto G (2nd Gen) (titan_umtsds), 1024MB RAM, Android 6.0</li>
  <li>Samsung Galaxy Win2 (coreprimeltedtv), 1024MB RAM, Android 5.0</li>
  <li>Motorola Moto G (1st Gen) (falcon_umts), 2048MB RAM, Android 7.1</li>
  </ul>
  
  <p>Unfortunately, Google Play Console doesn't provide much more information.</p>