InterruptedException when debugging Android app-ThrowExceptions

Exception or error:

When debugging in Android Studio, in certain scenarios the app crashes with following exception:

08-27 18:01:25.144  19241-24656/? E/AndroidRuntime﹕ FATAL EXCEPTION: pool-7-thread-1
Process: com.callsign.android.dev, PID: 19241
java.lang.InterruptedException
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:1991)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2025)
        at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
        at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:820)

This happens

  • only when debugging
  • only on certain devices (i.e. Moto G, Nexus 4)

It does not happen on Oneplus One or Xperia L for example.

I haven’t found any other information to help us identify the problem. Anybody else running into this issue?

How to solve:

Try Async Task or for your part of code.
“AbstractQueuedSynchronizer”
looks Synchronizing problem.

public class Task extends AsyncTask<Void, Void, Void>
    {
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }

        protected Void doInBackground(Void... paths) {
            //here your code (approx from line 400 to 850)
           return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);
        }
    }

for call Task on button click or from any other method

new Task().execute();

Leave a Reply

Your email address will not be published. Required fields are marked *