The Android SDK has a device emulator. I use it in Eclipse with the Android JUnit test framework. A few days ago, the emulator refused to start.
From Window -> AVD Manager, I started one of the devices. A dialog titled “Starting Android Emulator” came up. Inside it, a progress bar ticked off ten seconds. Then, nothing. This behavior was the same for all my devices, from Android version 1.5 through version 4.0.3.
To see if the problem was related to Eclipse, I started the emulator from the command line. To do this, you need the name of the AVD:
android list avd
Using my Android 1.5 virtual device, I tried to start it:
emulator -avd OldAndroid
And the result was “Segmentation fault”. I turned on “verbose” and ran again:
emulator -verbose -avd OldAndroid
This prints out what’s happening. The last line before the seg fault was: “emulator: Initializing hardware OpenGLES emulation support”. Next, I tried to see which system call failed:
strace emulator -avd OldAndroid
The last line there is a futex call with operation FUTEX_WAIT and no timeout. This call was unfinished, resulting in the seg fault. From the manual page for futex: “This operation atomically verifies that the futex address uaddr still contains the value val, and sleeps awaiting FUTEX_WAKE on this futex address.” The address appears in the lines above.
A bug report was filed today about this issue: http://code.google.com/p/android/issues/detail?id=34233
Zymurgeek | 21-Jul-12 at 6:11 am | Permalink
Update: I backleveled the android SDK to version 18 (linked in comment #25). The archive contains three directories, but since add-ons and platforms are empty, only replace the tools directory.
This fixed the emulator from the command line, but Eclipse complains ADT requires version 20.
Zymurgeek | 21-Jul-12 at 6:51 am | Permalink
To backlevel a plug-in in Eclipse, you can use Help -> About Eclipse -> Installation Details, select the Installation History tab and select a prior installation. However, the older versions of ADT are no longer in the repository.
As a work-around, download http://dl.google.com/android/ADT-18.0.0.zip. In Eclipse, uninstall ADT with Help -> About Eclipse -> Installation Details -> Installed Software tab . Select all the android version 20 plug-ins and select Uninstall. Restart Eclipse.
Install the zipped plug-in with Help -> Install New Software. Next to “Work with”, select Add. Select Archive and choose your ADT zip file. The rest of the install is straightforward.
Zymurgeek | 01-Feb-13 at 7:58 pm | Permalink
Recently I needed to upgrade the Android SDK Tools, which brought back this bug. Then I discovered I could run with GPU emulation enabled in the AVD, but that caused screen updates to lag horribly. Thanks to an update to the bug report above, I learned that
emulator-arm
works. I renamedemulator
toemulator-orig
and linkedemulator-arm
toemulator
. After editing my AVDs to disable GPU emulation, everything’s working again.