Capture screenshot in GenyMotion

Android EmulatorGenymotion

Android Emulator Problem Overview


I am using Genymotion for running android application. Could any one tell me how to capture screen shot in Genymotion ?

Android Emulator Solutions


Solution 1 - Android Emulator

If you are using Android Studio or Eclipse, you can just click the button "Screen Capture" in the Android DDMS:

enter image description here

Solution 2 - Android Emulator

You can use adb to get the screenshot from command line:

adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png

This article has the details: http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html

To make my life easier, I made an alias in .bash_profile:

alias screenshot="adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ~/Downloads/android_screenshot.png"

Now I can type screenshot in Terminal and get a screenshot of currently running emulator in my Downloads directory.

Solution 3 - Android Emulator

Disclaimer : I'm part of the same company as the Genymotion team.

This feature is included in the product. It is one of the paid feature of the screencast widget. Look at the pricing page here.

Two ways to access it:

  • pay for the pro or indie licence
  • use the trial version, it offers you the indie features. Be careful, there is only one trial day left :-/

Once your VM is started, open the screencast widget

enter image description here

Then take a picture with the dedicated button

enter image description here

UPDATE: You have bellow another ways to take a screenshot using Android Device Monitor or the command line

Solution 4 - Android Emulator

Use this commands:

  • Windows:

     C:\"Program Files"\Genymobile\Genymotion\tools\adb shell screencap -p "/mnt/sdcard/output.png" && C:\"Program Files"\Genymobile\Genymotion\tools\adb pull "/mnt/sdcard/output.png" "C:\output.png" && C:\"Program Files"\Genymobile\Genymotion\tools\adb shell rm "/mnt/sdcard/output.png"
    
    • Note: Make sure you have permission to write to C:\output.png; otherwise, change it to whatever path you like.
  • OS X:

     /Applications/Genymotion.app/Contents/MacOS/tools/adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ~/Desktop/Android_Screenshot_$(date +%Y-%m-%d-%H-%M-%S).png
    

Solution 5 - Android Emulator

  1. Select genymotion simulator

  2. Hit shortcut key describe below

  • Windows : Ctrl+Shift+S

  • Mac : Cmd+Shift+S

  1. You can find your screenshots at desktop

Solution 6 - Android Emulator

I think you can also take videos for free. Genymotion uses VirtualBox to do almost all the heavy lifting, so you should open VirtualBox and look at what you can do in it.

You will find options in Virtualbox to capture video! enter image description here

Solution 7 - Android Emulator

> adb shell screencap -p /sdcard/screen.png

Solution 8 - Android Emulator

If your Mac is slow and you hate running Eclipse and the emulator together here is a quicker way.

  1. Export your apk.
  2. Start Genymotion.
  3. Drag the apk to the emulator, in order to install it.
  4. Go to 'android-sdk-macosx>tools>ddms'.
  5. Run that file.
  6. A new instance of ddms will be started. Unlike Eclipse, it doesn't slow down your system.
  7. Use the 'Menu>Device>Screenshot' option to take screenshot.

This is a good option for those using slow computers.

Solution 9 - Android Emulator

If you are using Eclipse, then follow the steps for any type of emulator:

  1. Select DDMS
  2. In Devices window of DDMS select Genymotion device
  3. Click on Camera icon then save it to specific location. In Devices window just click on Camera icon. I already mark it by circle here

Solution 10 - Android Emulator

For Linux and Windows (I used gitbash on windows)

adb shell screencap -p | sed 's/\r$//' > screen.png

For Mac

adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png

Solution 11 - Android Emulator

@Reck says there's a bug in the Genymotion implementation so we can't take screenshots on 2.3.7. This means that Android Studio / DDMS can't get the proper pixels. adb shell screencap says there's no screencap command.

Assuming you have access to the code you can simply call this method:

public static void screenshot(View view) {
    Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
    view.draw(new Canvas(bitmap));
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    try {
        File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
        storageDir.mkdirs();
        File file = File.createTempFile(timeStamp, ".png", storageDir);
        bitmap.compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(file));
        Log.i("SCREENSHOT", "adb pull " + file);
    } catch (IOException e) {
        Log.e("SCREENSHOT", "Cannot save screenshot of " + view, e);
    }
}

In Activity:

screenshot(getWindow().getDecorView());

In Fragment:

screenshot(getActivity().getWindow().getDecorView());

The only limitation I know is that it won't include the status bar.

Solution 12 - Android Emulator

if you use Mac, sometimes CMD + Shift + 4 (screenshot of a selected portion in OSX ) and then selecting the simulator region is enough :)

Solution 13 - Android Emulator

Take a screenshot

On many Android devices, you can capture a screenshot with a key-combination: Simultaneously press-and-hold Power and Volume-down. You can also capture a screenshot with Android Studio as follows:

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. The screenshot appears in a Screenshot Editor window

It Works for even Genymotion Emulator

Check here for further information

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionkavieView Question on Stackoverflow
Solution 1 - Android Emulatorelectronix384128View Answer on Stackoverflow
Solution 2 - Android EmulatorPavel AlexeevView Answer on Stackoverflow
Solution 3 - Android Emulatoreyal-lezmyView Answer on Stackoverflow
Solution 4 - Android EmulatorgabrielmaldiView Answer on Stackoverflow
Solution 5 - Android EmulatorJayesh LathiyaView Answer on Stackoverflow
Solution 6 - Android EmulatorTrophyGeekView Answer on Stackoverflow
Solution 7 - Android EmulatorM.GanjiView Answer on Stackoverflow
Solution 8 - Android EmulatorBilbo BagginsView Answer on Stackoverflow
Solution 9 - Android EmulatorSANATView Answer on Stackoverflow
Solution 10 - Android EmulatorNathView Answer on Stackoverflow
Solution 11 - Android EmulatorTWiStErRobView Answer on Stackoverflow
Solution 12 - Android EmulatorZasterView Answer on Stackoverflow
Solution 13 - Android EmulatorUpendranath ReddyView Answer on Stackoverflow