你如何保存android模拟器快照?

时间:2022-11-26 23:02:44

An update to the Android development tools was just released enabling you to save-to and restore-from an emulator snapshot. Does anyone know how to use this feature? This would greatly reduce the emulator's load time! But I can't find a way to tell the emulator to do so. Thanks.

刚刚发布了Android开发工具的更新,使您可以从模拟器快照进行保存和还原。有谁知道如何使用此功能?这将大大减少仿真器的加载时间!但我找不到告诉模拟器这样做的方法。谢谢。

5 个解决方案

#1


29  

Honeycomb introduced this feature, and it's pretty cool! It's like the hibernate feature on a laptop. You're saving the state of the emulator into a big file, and restoring its state from the file later.

Honeycomb推出了这个功能,非常酷!这就像笔记本电脑上的休眠功能。您将模拟器的状态保存到一个大文件中,然后从文件中恢复其状态。

There are a couple of ways to get it. The first way is to set your desired options in the Launch Options dialog when Starting the emulator from the Android SDK and AVD Manager (see image below). The Wipe user data option is still there from before, and that will create a new system from scratch. The new snapshot options are to Launch from snapshot (if one has been saved previously), or to Save to snapshot when the emulator shuts down. Obviously you have to save a snapshot before you can launch from one. The snapshot file can get rather large, and this adds to how long it takes for the emulator to exit when you close it. But it's worth it. Launching from a snapshot is very quick, compared to going through the entire boot-up sequence of Android. One of the tricks you could do is Save to snapshot once, then Launch from snapshot but don't Save to snapshot after that first time. Your startups will be fast and your exits will be fast. You'll be starting from the same snapshot state every time though, no matter what you do in each emulator session.

有几种方法可以实现它。第一种方法是在从Android SDK和AVD Manager启动模拟器时在“启动选项”对话框中设置所需的选项(请参见下图)。 Wipe用户数据选项仍然存在,它将从头开始创建一个新系统。新快照选项是从快照启动(如果先前已保存),或者在仿真器关闭时保存到快照。显然,您必须先保存快照,然后才能从一个快照启动。快照文件可能会变得相当大,这会增加模拟器关闭时退出所需的时间。但这是值得的。与通过Android的整个启动序列相比,从快照启动非常快。您可以执行的一个技巧是保存到快照一次,然后从快照启动但在第一次之后不保存到快照。你的初创公司会很快,你的出口会很快。无论您在每个仿真器会话中执行什么操作,您每次都将从相同的快照状态开始。

你如何保存android模拟器快照?

The other way to use snapshots is from the command line of emulator. The documentation currently doesn't mention these options, but by invoking the help option on emulator, we find these:

使用快照的另一种方法是从模拟器的命令行。文档目前没有提到这些选项,但通过在模拟器上调用帮助选项,我们发现:

-snapstorage <file>            file that contains all state snapshots (default <datadir>/snapshots.img)
-no-snapstorage                do not mount a snapshot storage file (this disables all snapshot functionality)
-snapshot <name>               name of snapshot within storage file for auto-start and auto-save (default 'default-boot')
-no-snapshot                   perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage
-no-snapshot-save              do not auto-save to snapshot on exit: abandon changed state
-no-snapshot-load              do not auto-start from snapshot: perform a full boot
-snapshot-list                 show a list of available snapshots
-no-snapshot-update-time       do not do try to correct snapshot time on restore

I haven't tried snapshots from the command line since the Launch Options dialog is easier. EDIT: One more thing, the snapshot file gets stored in the same place as your AVD files.

我没有尝试从命令行创建快照,因为启动选项对话框更容易。编辑:还有一件事,快照文件存储在与AVD文件相同的位置。

#2


21  

Apparently you can also do it via the console interface:

显然你也可以通过控制台界面来做到这一点:

$ 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 foo

#3


3  

Right. Assuming you checked "Enable Snapshot" while creating the avd, simply closing the emulator saves its state and is restored on the next run, be it from the manager or from eclipse.

对。假设您在创建avd时选中了“启用快照”,只需关闭模拟器即可保存其状态,并在下次运行时恢复,无论是来自管理器还是来自eclipse。

#4


2  

I don't know is there any option available to restore from.

我不知道有没有可供恢复的选项。

But you can save your emulator's current snapshot

但您可以保存模拟器的当前快照

Change your view perspective from Java to DDMS . By clicking the button encircled in red you can save a copy your emulator's current snapshot

将您的视图角度从Java更改为DDMS。通过单击红色环绕的按钮,您可以保存模拟器当前快照的副本

你如何保存android模拟器快照?

#5


1  

For shell users, if you're running a --no-window emulator: It looks like using kill -2 to signal the emulator process will save the default boot snapshot, assuming you created the emulator with the --snapshot option.

对于shell用户,如果您正在运行--no-window模拟器:假设您使用--snapshot选项创建了模拟器,看起来使用kill -2来表示模拟器进程将保存默认引导快照。

Do this:

做这个:

killall -2 emulator64-x86

The next time you boot that emulator, launching with anything but the -no-snapshot-load option will restore from that snapshot.

下次启动该仿真器时,除了-no-snapshot-load选项之外的任何其他选项都将从该快照恢复。

#1


29  

Honeycomb introduced this feature, and it's pretty cool! It's like the hibernate feature on a laptop. You're saving the state of the emulator into a big file, and restoring its state from the file later.

Honeycomb推出了这个功能,非常酷!这就像笔记本电脑上的休眠功能。您将模拟器的状态保存到一个大文件中,然后从文件中恢复其状态。

There are a couple of ways to get it. The first way is to set your desired options in the Launch Options dialog when Starting the emulator from the Android SDK and AVD Manager (see image below). The Wipe user data option is still there from before, and that will create a new system from scratch. The new snapshot options are to Launch from snapshot (if one has been saved previously), or to Save to snapshot when the emulator shuts down. Obviously you have to save a snapshot before you can launch from one. The snapshot file can get rather large, and this adds to how long it takes for the emulator to exit when you close it. But it's worth it. Launching from a snapshot is very quick, compared to going through the entire boot-up sequence of Android. One of the tricks you could do is Save to snapshot once, then Launch from snapshot but don't Save to snapshot after that first time. Your startups will be fast and your exits will be fast. You'll be starting from the same snapshot state every time though, no matter what you do in each emulator session.

有几种方法可以实现它。第一种方法是在从Android SDK和AVD Manager启动模拟器时在“启动选项”对话框中设置所需的选项(请参见下图)。 Wipe用户数据选项仍然存在,它将从头开始创建一个新系统。新快照选项是从快照启动(如果先前已保存),或者在仿真器关闭时保存到快照。显然,您必须先保存快照,然后才能从一个快照启动。快照文件可能会变得相当大,这会增加模拟器关闭时退出所需的时间。但这是值得的。与通过Android的整个启动序列相比,从快照启动非常快。您可以执行的一个技巧是保存到快照一次,然后从快照启动但在第一次之后不保存到快照。你的初创公司会很快,你的出口会很快。无论您在每个仿真器会话中执行什么操作,您每次都将从相同的快照状态开始。

你如何保存android模拟器快照?

The other way to use snapshots is from the command line of emulator. The documentation currently doesn't mention these options, but by invoking the help option on emulator, we find these:

使用快照的另一种方法是从模拟器的命令行。文档目前没有提到这些选项,但通过在模拟器上调用帮助选项,我们发现:

-snapstorage <file>            file that contains all state snapshots (default <datadir>/snapshots.img)
-no-snapstorage                do not mount a snapshot storage file (this disables all snapshot functionality)
-snapshot <name>               name of snapshot within storage file for auto-start and auto-save (default 'default-boot')
-no-snapshot                   perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage
-no-snapshot-save              do not auto-save to snapshot on exit: abandon changed state
-no-snapshot-load              do not auto-start from snapshot: perform a full boot
-snapshot-list                 show a list of available snapshots
-no-snapshot-update-time       do not do try to correct snapshot time on restore

I haven't tried snapshots from the command line since the Launch Options dialog is easier. EDIT: One more thing, the snapshot file gets stored in the same place as your AVD files.

我没有尝试从命令行创建快照,因为启动选项对话框更容易。编辑:还有一件事,快照文件存储在与AVD文件相同的位置。

#2


21  

Apparently you can also do it via the console interface:

显然你也可以通过控制台界面来做到这一点:

$ 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 foo

#3


3  

Right. Assuming you checked "Enable Snapshot" while creating the avd, simply closing the emulator saves its state and is restored on the next run, be it from the manager or from eclipse.

对。假设您在创建avd时选中了“启用快照”,只需关闭模拟器即可保存其状态,并在下次运行时恢复,无论是来自管理器还是来自eclipse。

#4


2  

I don't know is there any option available to restore from.

我不知道有没有可供恢复的选项。

But you can save your emulator's current snapshot

但您可以保存模拟器的当前快照

Change your view perspective from Java to DDMS . By clicking the button encircled in red you can save a copy your emulator's current snapshot

将您的视图角度从Java更改为DDMS。通过单击红色环绕的按钮,您可以保存模拟器当前快照的副本

你如何保存android模拟器快照?

#5


1  

For shell users, if you're running a --no-window emulator: It looks like using kill -2 to signal the emulator process will save the default boot snapshot, assuming you created the emulator with the --snapshot option.

对于shell用户,如果您正在运行--no-window模拟器:假设您使用--snapshot选项创建了模拟器,看起来使用kill -2来表示模拟器进程将保存默认引导快照。

Do this:

做这个:

killall -2 emulator64-x86

The next time you boot that emulator, launching with anything but the -no-snapshot-load option will restore from that snapshot.

下次启动该仿真器时,除了-no-snapshot-load选项之外的任何其他选项都将从该快照恢复。