question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Returning empty screenshot on Android 4.4.2

See original GitHub issue

I am taking screenshot by well known way:

File screenshot = device.getScreenshotAs(OutputType.FILE);
String deviceName = device.getCapabilities().getCapability("deviceName").toString();
File destFile = new File(BUILD_DIR + File.separator
            + deviceName + "-" + screenshotName + ".png");
try {
   FileUtils.copyFile(screenshot, destFile);
} catch (IOException ex) {
   throw new RuntimeException(ex);
}

It works just fine on my devices, expect Samsung Galaxy S4, which is running Android 4.4.2.

In Appium server log I can find these lines:

/wd/hub/session/5a1b71ee-5b92-468d-8c54-eb1356f837dc/screenshot
[debug] executing cmd: path/to/sdk/platform-tools/adb -s [particularSerialNumber] shell "/system/bin/rm /data/local/tmp/screenshot.png; /system/bin/screencap -p /data/local/tmp/screenshot.png "
[debug] executing cmd: path/to/sdk/platform-tools/adb -s [particularSerialNumber] pull /data/local/tmp/screenshot.png "/tmp/appium11553-11542-1iswk7x.png"
[debug] Responding to client with success: {"status":0,"value":"","sessionId":"5a1b71ee-5b92-468d-8c54-eb1356f837dc"}
<-- GET /wd/hub/session/5a1b71ee-5b92-468d-8c54-eb1356f837dc/screenshot {"status":0,"value":"","sessionId":"5a1b71ee-5b92-468d-8c54-eb1356f837dc"}

Please see that value is empty. In result it creates an empty file.

When executing those adb commands manually, it works. I am running Appium from source, with pretty much fresh master (May 4) - all found issues related to screenshots were resolved sooner.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
imurchiecommented, Jul 20, 2017

This has all been changes. Closing.

0reactions
lock[bot]commented, Apr 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I screenshot on my RCA Andriod 4.4.2 10" tablet?
You can make a screenshot by pressing the Volume down and Power buttons at the same time. This is a default feature since...
Read more >
How do I prevent Android taking a screenshot when my app ...
Try FLAG_SECURE : public class FlagSecureTestActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.
Read more >
Take a screenshot or record your screen on your Android device
Press the Power and Volume down buttons at the same time. At the bottom, tap Capture more. To select the content you want...
Read more >
Private Screenshots - Apps on Google Play
Intro Some of the messaging apps detect screenshots you made from conversations. They notify person, you're chatting with, about the fact ...
Read more >
How To Take Samsung Galaxy S4 Android 4.4 KitKat Screen ...
How To Take Samsung Galaxy S4 Android 4.4 KitKat Screen Shot / Capture / Print Screen. 22K views 9 years ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found