Capture screenshot in GenyMotion
Android EmulatorGenymotionAndroid 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:
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
Then take a picture with the dedicated button
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.
- Note: Make sure you have permission to write to
-
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
-
Select genymotion simulator
-
Hit shortcut key describe below
-
Windows : Ctrl+Shift+S
-
Mac : Cmd+Shift+S
-
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!
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.
- Export your apk.
- Start Genymotion.
- Drag the apk to the emulator, in order to install it.
- Go to 'android-sdk-macosx>tools>ddms'.
- Run that file.
- A new instance of ddms will be started. Unlike Eclipse, it doesn't slow down your system.
- 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:
- Select DDMS
- In Devices window of DDMS select Genymotion device
- Click on Camera icon then save it to specific location.
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