Android Studio errror tryin to get an screenshot : "Unexpected error while obtaining screenshot from device: EOF"

Viewed 1929

I'm trying to get screenshots from my device from Android Studio

introducir la descripción de la imagen aquí

but i get the message

"Unexpected error while obtaining screenshot from device: EOF"

I tried unplugging my device and restarting Android Studio with no success.

¿How to solve this problem without having to restart my pc?

3 Answers

I can confirm this bug is still present in the latest adb.exe.

The only working solution at this moment is replacing adb.exe with the last working version. You can find it inside this zip:

https://dl.google.com/android/repository/platform-tools_r28.0.0-windows.zip

Close Android Studio, then extract the file adb.exe (nothing else!) and override the faultly adb.exe at your platform-tools folder.

Default path for adb in Windows:

C:\Users\%USERNAME%\AppData\Local\Android\Sdk\platform-tools\

Finally, just open Android Studio again, and enjoy using the Screen Capture feature again.

I have found two solutions:

At the beginning I tought that the problem would be the ADB but the ADB was running.

I) Open task manager, end the process and tried again succesfully.

enter image description here

II)

I look for the process in the Task Manager to stop the process:

introducir la descripción de la imagen aquí

and then i searched into my Android SDK folder /platform-tools/ directory for the adb.exe to start the process again.

introducir la descripción de la imagen aquí

now i can get the screenshots.

Try to remove security flag form activities! It helped for me (If not try to restart Android Studio too).

// getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
Related