android emulator snapshot

本来打算采用process snapshot方面,自己写的话太复杂,而且也不一定能成功。

win7更可恶,想用process monitor看看emulator对文件的操作,好猜到snapshot的保存位置,结果win7跑不了pm。

人工猜测到snapshot是在img里面


anwser:

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.

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.

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.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

winsunxu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值