Snapshots and the New Android AVD Manager

So one of the biggest pains to mobile development with emulators is that starting up the emulator takes forever. Android tools version 9 addressed this finally by letting you take a snapshot of the emulator, just like you would do with a virtual machine. Here’s how I got my emulators really snappy.

First on the initial launch make sure you select Save to snapshot. Get the emulator up and running and put it into the state you want. I like to have it start at the desktop (home screen) view. Now close the emulator. I found that it wasn’t very responsive when closing, so wait a bit, watch the mouse icon go to “busy” and let it write everything to disk.

Now, launch the emulator again and this time uncheck Save to snapshot but make sure Launch from snapshot is chosen. Voila! The emulator launches quickly. And when you save it it shuts down quickly because it’s not saving anymore.

One caveat I’ve found with the emulator. When moving from network to network (i.e. one wifi point to another) for some reason the emulator loses Internet access (returning “host cannot be null” for HTTP requests). Unfortunately this means I have to have a save emulator snapshot for each of my common network and launch a new one, not from snapshot, when I’m on a new network. Anyone have any idea how to fix this?

Advertisement

9 thoughts on “Snapshots and the New Android AVD Manager

  1. Hy ! I tried your method of fastening my emulator’s startup but it won`t work. I did as you said and after i relaunch the emulator it starts and just after that it shuts down immediately. What problem can it be ?

  2. Mihai,

    It sounds to me like the snapshot saved a bad image. Try starting it up without “Launch from snapshot” checked so that it launches a new instance, but make sure “Save to snapshot is checked so that it will save a new image once launched.

    Also, if you are going to continue loading from the same image (that is, “Save to snapshot” unchecked) so that it shuts down quickly, make sure the emulator image that you save is in a clean state.

  3. Thank you for responding Jeremy !

    Something is wrong with my AVD Manager for sure. As I tried to launch with only “Save to snapshot”- checked and “Launch from snapshot”- unchecked, I got the common Windows XP error: “emulator.exe has encountered a problem and needs to close. We are sorry for the inconvenience. Send Error Report/ Don`t Send “. After that I tried again and it worked. After i closed de AVD and lauched it with only “Launch from snapshot” checked I got the same error. Can the emulator version ( Android SDK Revision 10 ) take the blame ? This type of error i got in Eclipse Helios too and the cure (found on the Internet) was to use instead Eclipse Galileo.

    I also have only 2GB of RAM and a Sempron 3000+ (1.6 GHz) Processor and WinXP SP2.

  4. Can you also tell me where does the emulator images save ? I noticed that when I lauch it with both “Launch from snapshot” and “Save to snapshot” unchecked i get no error. Something goes wrong with that image and I would like to know where does it save. Thank You !

  5. I have been using tools version 9, not 10, yet. I have no idea where the files are stored. It all worked smoothly for me, so I never dug into it. While it doesn’t sounds like your issue, there’s a reported problem loading v9 snapshots under v10. However, in a comment to that issue someone mentions what sounds like exactly your problem.

  6. Thank you for your interest in solving my issue ! If anyone else has this problem and sees this post I have to say that I didn’t get that error when I created an AVD with Snapshot disabled. Then I could start it once and let it ran in the background with no problem (my computer ran smoothly with the AVD running) which is not possible with Snapshot enabled because it crashes (even with both “Load from snapshot” and “Save to snapshot” disabled). I will try to get tools version 9 in order to use Snapshot. Thank You !

  7. “Lunch from snapshot” and “Save to snapshot” radio buttons are disabled when I try to launch avd. Why?

    1. It’s been a long time since I looked at this. “Launch from” is disabled if you’ve never saved a snapshot. “Save to” should be enabled; I can’t think why it wouldn’t be offhand.

    2. @tramvon: edit the device, under Emulation Options select “snapshot”. 🙂
      I’ve no idea why that’s off by default. or why it’s there in the first place – having to enable snapshots twice is bizarre.

Leave a Reply to Jeremy Wadsack Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s