Android Studio fails taking screenshot of device

Viewed 369

Android Studio sometimes gives the following errors when I try to take a screenshot of physical device from the Debug tab.

These errors appear on the "Dump #1" sub-tab of the Debug tab:

"GAC_Executor[0]@5406" prio=5 tid=0x51eb nid=NA waiting
  java.lang.Thread.State: WAITING
     blocks GAC_Executor[0]@5406
      at java.lang.Object.wait(Object.java:-1)
      at java.lang.Thread.parkFor$(Thread.java:2135)
      - locked <0x1aa5> (a java.lang.Object)
      at sun.misc.Unsafe.park(Unsafe.java:358)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2059)
      at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
      at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1087)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1147)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
      at Os.run(SourceFile:5)
      at java.lang.Thread.run(Thread.java:764)

Another type of error:

"CrAsyncTask #1@4908" prio=5 tid=0x161 nid=NA waiting
  java.lang.Thread.State: WAITING
     blocks CrAsyncTask #1@4908
      at java.lang.Object.wait(Object.java:-1)
      at java.lang.Thread.parkFor$(Thread.java:2135)
      - locked <0x180a> (a java.lang.Object)
      at sun.misc.Unsafe.park(Unsafe.java:358)
      at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2101)
      at java.util.concurrent.ArrayBlockingQueue.poll(ArrayBlockingQueue.java:402)
      at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1086)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1147)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
      at java.lang.Thread.run(Thread.java:764)

Another type of error:

"FinalizerDaemon@6149" daemon prio=5 tid=0x158 nid=NA waiting
  java.lang.Thread.State: WAITING
     blocks FinalizerDaemon@6149
      at java.lang.Object.wait(Object.java:-1)
      at java.lang.Object.wait(Object.java:422)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:188)
      - locked <0x1808> (a java.lang.Object)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:209)
      at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:232)
      at java.lang.Daemons$Daemon.run(Daemons.java:103)
      at java.lang.Thread.run(Thread.java:764)

Another type of error:

"CleanupReference@5418" daemon prio=5 tid=0x16b nid=NA waiting
  java.lang.Thread.State: WAITING
     blocks CleanupReference@5418
      at java.lang.Object.wait(Object.java:-1)
      at java.lang.Object.wait(Object.java:422)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:188)
      - locked <0x180e> (a java.lang.Object)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:209)
      at ayH.run(SourceFile:3)

Another type of error:

"ReferenceQueueDaemon@6148" daemon prio=5 tid=0x157 nid=NA waiting
  java.lang.Thread.State: WAITING
     blocks ReferenceQueueDaemon@6148
      at java.lang.Object.wait(Object.java:-1)
      at java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:178)
      - locked <0xc44> (a java.lang.Class)
      at java.lang.Daemons$Daemon.run(Daemons.java:103)
      at java.lang.Thread.run(Thread.java:764)

Another type of error:

"FinalizerWatchdogDaemon@6150" daemon prio=5 tid=0x159 nid=NA sleeping
  java.lang.Thread.State: TIMED_WAITING
     blocks FinalizerWatchdogDaemon@6150
      at java.lang.Thread.sleep(Thread.java:-1)
      at java.lang.Thread.sleep(Thread.java:373)
      - locked <0x1809> (a java.lang.Object)
      at java.lang.Thread.sleep(Thread.java:314)
      at java.lang.Daemons$FinalizerWatchdogDaemon.sleepFor(Daemons.java:342)
      at java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization(Daemons.java:364)
      at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:281)
      at java.lang.Daemons$Daemon.run(Daemons.java:103)
      at java.lang.Thread.run(Thread.java:764)

Usually I can work around it by restarting Android Studio but today I'm getting it more consistently.

I've also tried restarting my Mac, restarting the Nexus 5x physical device, replugging the device into a different port, and issuing the adb kill-server command. None of that helped.

Anyone know what causes this problem and how to avoid it?

2 Answers

This might be something from Android Studio 3.2. Can you update it to a newer one?

I'm using 3.2.1 (October 09, 2018) on my Mac without any problem.

It happens if you attach a debugger to the app and then try to press a camera icon at Tool Windows > Debug. Actually the camera icon on debug window is for thread dump not for a screenshot. So it is misleading.

You have to press Logcat window > camera. Follow the below instructions as mentioned at

https://developer.android.com/studio/debug/am-screenshot

Run your app on a connected device or emulator. If using a connected device, be sure you have enabled USB debugging. In Android Studio, select View > Tool Windows > Logcat to open Logcat. Select the device and a process from the drop-down at the top of the window. Click Screen Capture on the left side of the window.

Related