Pages

Tuesday, January 11, 2011

When the emulator won't start

Last time I talked about the slow starting of the emulator, now here is the related issue of simply getting it to start at all.  It doesn't give any useful error messages (at least by default) so it can be difficult to know what has gone wrong, and when you should start thinking that it's not merely slow, it's stopped all together.

Here are a few things I've found will cause the emulator to fail to start:
No Internet connection
The emulator requires an Internet connection to start, and without one, it will never finish loading.  So if you have an Internet connection that needs to be manually connected, and you haven't bothered because your app doesn't require the Internet, you may be left wondering why it won't start.

No Sound
The emulator also needs sound (it is supposed to be a phone, after all.)  I've tried running the emulator on a Linux box with a wonky sound configuration that befuddles many programs, and I've found I can't get it to start without specifying the -no-audio option.

Aborted Launch
Another problem is caused by an aborted first launch of the emulator.  The first time it runs with a given virtual device (AVD) the emulator needs to construct the memory image for the device.  If the emulator gets shut down before this image is completed, the emulator will not be able to use the unfinished image, nor will it be able to pick up where it left off; it simply won't work.
That's unfortunate since (as mentioned in the last post) the emulator takes longer to load than one would expect.  So a likely scenario is that the user starts the emulator, waits, assumes something is wrong and shuts it down, thus guaranteeing it won't work.
If this has happened, delete the AVD and recreate it. (Use the AVD manager, or delete the directory from the .android/avd directory.)

And if none of this helps, try starting the emulator with one of the debug flags (such as -debug-init.)  Try, emulator -help-debug-tags for all the options.

No comments:

Post a Comment