The Android Virtual Device: Performance Issues

One of the best things about the Android development platform is the superb emulator or Android Virtual Device (AVD). One of the worst things about the Android development platform is… Yes, you guessed, it’s the AVD.

The Android AVD is a great idea, it provides real device emulation which allows you to run the actual code for your apps in a nice safe environment on your PC. Realistically, it is the only way to get close to testing apps on all the available screen sizes for most developers. The fact that it also runs your real-code rather than code compiled for a totally different processor (as does the iOS simulator) is also a big positive. In my development environment, during testing, I often have 5-6 AVDs open with different screen sizes and orientations displayed in addition to the real devices plugged in via USB. This is all great positive stuff so, what are the negatives of all of this?

Spend a few moments Googling for AVD and issue or AVD and problem and you will see vast numbers of results. The system is far from perfect. Let’s take a look at one of the most significant of these issues which is performance:

The performance of the AVDs can be awful with start-up times of 5 or more minutes. There are however several things you can do about this: the most obvious thing is to get yourself more powerful host system! Seriously, I’ve just switched from a 2Ghz Core 2 machine to a 2.5Ghz quad core i7 and the improvement is spectacular. To give you a taste: starting an emulator with the WXGA720 skin and the ARM7 processor for the 1st time (which is by far the worst case) was taking about 6 minutes on the Core 2. I just tried it in the background whilst writing this on the i7 and it took 1min 22seconds.

In fact, moving to the i7 does much more that just improve start-up speeds, it seems to improve stability too. Examining the LogCat output for AVD start-up on the Core 2 machine shows huge numbers of errors which I suspect are time-out related. On the i7 machine, these have all gone. I read recently that Google does not have any machines older than 2 years. My guess is that the guys working on AVD development are all using top-end systems and never even see these problems!

The other major thing which you really must do is to enable snapshots. Snapshots are a memory image of the AVD much the same as the image of a Windows machine when hibernated. When you create the AVD, just select the enabled check-box in the Snapshot panel. When you start the emulator, you get three options: Wipe user data, Launch from Snapshot and Save to Snapshot. I leave the Launch and Save options checked most of the time. Very occasionally, you will need to use Wipe user data which is equivalent to a factory-reset on a real device. With snapshots enabled, the first start-up will not be effected (that’s probably obvious!) subsequent start-ups are blinding. On the i7 machine, the WXGA720 emulator starts in less than 3 seconds! The down-side is that the shut-down takes about 4 seconds. You can of course clear the save snapshot button in which case the shutdown is almost instant.

I can honestly say that on the i7 platform and with snapshots enabled the performance is good enough that I often don’t bother with a real device to try out new code in the early phases of development. You do of course need to test on real devices before you deploy to the market. We have used i7 machines for the first run of Learning Tree’s new Android course(Building Android™ Applications: Extended Features) this week and I am delighted with how well the AVDs have performed.

Mike Way

Type to search

Do you mean "" ?

Sorry, no results were found for your query.

Please check your spelling and try your search again.