Want to make any mobile developer flinch? All you have to do is mention the Android Emulator. Even with Google’s recent updates this is still a pain point for many developers.
It looks like some relief is here. Last night on twitter Tony Lukasavage posted a tip on using snapshots.
The Android emulator snapshot enables the ability to save and restore its state to a ‘snapshot’ file in each AVD – so you can usually avoid booting when you start the emulator. You can read more about this on the Android Tools site here.
In my testing, this is literally a “Go Faster” button and has reduced my load times from 5 minutes to about 1 minute.
Great how do I enable it?
Here is a quick walk through on how I enabled this feature. Before you start make sure you close the Android emulator.
Open the AVD Manager
The first thing you want to do is open the AVD manager. The easiest way to do this is by going to your <Android SDK Folder>/tools directory and issuing the terminal command ./Android AVD as shown below.
This will open the AVD Manager and show you all of the AVD images you’ve created. The below shows what the AVD Manager looks like on my machine.
You can see that all of my AVD images have been generated by the Titanium build process.
Enable Snapshot in your AVD image
After you’ve opened the AVD Manager you want to select an AVD Image to enable snapshots. Select your AVD Name and select the Edit button on the right side of the AVD Manager menu.
This will open the AVD Editor screen. If you have Android Tools r9 or higher you should see a section called Snapshot ( circled below ). Update the checkbox to enable this feature.
After enabling the snapshot feature press the Edit AVD button. You will receive a confirmation message similar to the below.
You will want to repeat this process with all of your AVD files.
The next time you launch the emulator for your updated AVD images you’ll see a dramatic improvement in launch speed.