When I first started with Android development, I tried use the built-in emulator and was shocked by how long it took to launch (anywhere from 4 to 10 minutes on my laptop). Crawling the boards it became obvious this was a common issue and that most developers used real devices – I followed suit and we’ve been happily debugging on a Samsung Galaxy SII and a Nexus One ever since.
Today, before an early release, we wanted to test it on some other configurations, so I fired up AVD. 3 hours (and a lot of red console messages) later, here’s what I learned:
The first error was:
[text]"Failed to install blah.apk on device ’emulator-5554′: timeout"[/text]
Fix: (from Eclipse) Window > Preferences > Android > DDMS > ADB Timeout something… Increased that from 5000 (default) to 10000
Ran again. Got this:
[text]Failed to install blah.apk on device ’emulator-5554′: No space left on device[/text]
Fix: (from Eclipse) Window > AVD Manager > <select device> increase SD Car size to 500MB. In same window, in a little table under “Hardware”, change “Max VM Application Heap Size” to 100.
Ran again. More red:
[text]Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE[/text]
Fix: (from Eclipse) click the drop-down arrow to the right of the “Run” icon. Select “Run Configurations”. Click the “Target” tab. Check the virtual device you want to use. In the same window, there’s an area called “Emulator Launch Parameters” – this does not have a scrollbar, but there is overflow content – I just got lucky and guessed, and by resizing the window I saw an input box labelled “Additional Emulator Command Line Options” – put the following line in that box: “-partition-size 1024” (omit the quotes).
Now, as long as you launch the emulator from the Run icon (so it considers the options supplied above), you’ll have probably a better than even chance of getting your application to run. If you end up staring at a lock icon on your emulator screen for 15-20 minutes like I did, use you mouse to drag the lock to the right to open the device and see your app.