Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I take a snapshot of the Android emulator's state?

When I launch the Android emulator from the Android SDK and AVD Manager I can check the boxes Launch from snapshot and Save to snapshot so that the emulator's state is saved when I close it and restored again when I launch it. This is great because I don't have to wait for Android to boot each time the emulator is launched. However, I also want to take snapshots of the emulator's state during a session and later during the session revert back to the snapshot, for example to re-run my tests. How do I do this? There do not seem to be any controls for this in the AVD Manager.

like image 680
Claes Avatar asked Jun 02 '11 17:06

Claes


People also ask

Where are Android emulator screenshot stored?

Press for 3 dots. Then Press the Settings and in top right corner you will see the screenshot folder location.

What is snapshot in Android emulator?

Saving an emulator's state to a snapshot file enables the emulator to be started quickly the next time you try to launch it, effectively bypassing the lengthy boot-up time. This is especially useful for the Android 3.0 emulator, which can take up to five minutes to boot up.

Does camera work on Android emulator?

Camera support. The emulator supports the use of basic camera functionality on your virtual device for earlier Android versions. Android 11 and higher supports the following additional Android Emulator camera capabilities: RAW capture.


1 Answers

I found the answer thanks to this comment. To take and load snapshots, start a Telnet session to the emulator:

$ telnet localhost 5554
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
avd snapshot save snapshot_name
OK
avd snapshot load snapshot_name
OK

The Android emulator freezes for a few seconds while saving/loading a snapshot. You can also list the snapshots using avd snapshot list.

like image 152
Claes Avatar answered Sep 20 '22 15:09

Claes