5

I'm having trouble running the Android SDK on both of my Macs running OS X 10.6.2 Snow Leopard. This appears to be a 64-bit vs. 32-bit issue, as Snow Leopard now defaults to 64-bit everything, including the Java virtual machine.

I found this webpage with instructions on how to get the Android tools to run in the 32-bit Java VM, and I am now able to run the Android GUI tool to download SDK files, create AVM's, etc. However, when I try the Hello World tutorial and get to the point where I run my application under the Android emulator, everything goes south.

The emulator appears to start but it hangs (spinning beachball of death cursor) without displaying anything. (This only hangs the emulator; the rest of the system still works fine.) If I follow the exact same steps (minus the 32-bit Java hack) in a Windows virtual machine, everything works fine.

This occurs on both my Mac Pro tower and 13" MacBook Pro. Does anyone have any suggestions?

0

6 Answers 6

4

I was digging around the other day and saw this message appear on the terminal: emulator: warning: opening audio input failed I've seen this message many times before and I had always assumed that it was because the emulator didn't support sound or something like that. But I decided to try an experiment that one particular day. Turns out the emulator has a "-noaudio" command line option, and when I ran it with that, it worked!! So now I just run emulator with the -noaudio option always, no freezes. No sound support either, but at least I can run the emulator now.

Now, that works if I manually call the emulator from the command line. What about when the Eclipse ADT plugin calls it? Well I was feeling rather lazy at that point and didn't want to dig around in the ADT plugin to see if it had a "add these command line flags whenever running the emulator" option, so I made a little "wrapper" shell script for the emulator command that always adds the -noaudio option. It's a bit of a kludge, but it works. Here's how: (note: $ represents the shell prompt, don't type it yourself)

$ cd <WHERE YOU INSTALLED THE ANDROID SDK>/tools
$ mv emulator emulator.real
$ cat > emulator << EOF
#!/bin/sh
exec <WHERE YOU INSTALLED THE ANDROID SDK>/tools/emulator.real -noaudio $*
EOF
2

All the above tips sure works. The solution to the freezing problem is to just pass the -noaudio option flag when starting the emulator.

To further accelerate the startup of the emulator, you can add two other flags/options -cpu-delay and -no-boot-anim as follows:

$ emulator -cpu-delay 0 -no-boot-anim -no-audio -avd <avd name>

where -no-audio actually fixes the freezing problem. -no-boot-anim disables the boot animation and <avd name> should be replaced with the name of the avd image you want to run

1

I had the same problem, and it was fixed by simply unplugging my USB headset which was attached at the time I was executing the emulator

1
  • I had this problem with a Bluetooth stereo headset. Disconnecting it fixed the problem.
    – Sam
    Sep 13, 2011 at 22:57
1

The answer Donald Burr gave on Dec 31 '09 at 19:57 still applies even with the current SDK and tool-chain.

But you don't need the wrapper script if you use Eclipse. You can just pass the -noaudio commandline option within the specific run configuration of your application (on the "Target" tab in the "additional emulator command line options" field).

Forgot to add: I use a MacBook and have a 24-inch LED Cinema display attached, which is connected also by USB and provides sound speakers. So I guess the mentioned USB sound device bug is still somewhere inside the whole Android SDK package.

1

I had the same problem on OS X 10.8.4 on a MacBook Air. I eventually figured out the problem was only triggered on AVD relaunch. My workaround for now is to define a new AVD each time I restart the emulator.

0

i'm running 10.6.2, android 2.0.1, eclipse 3.5 with no problems, so must be something on your end. i'd return to default os x settings and reinstall the sdk. then try running the emulator from just the command line and see if that works...

mac:~ > java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)

mac:~ > uname -a
Darwin veritas 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386
1
  • Thanks for the tip. I was digging around the other day and saw this message appear on the terminal: emulator: warning: opening audio input failed I've seen this message many times before and I had always assumed that it was because the emulator didn't support sound or something like that. But I decided to try an experiment that one particular day. Turns out the emulator has a "-noaudio" command line option, and when I ran it with that, it worked!! So now I just run emulator with the -noaudio option always, no freezes. No sound support either, but at least I can run the emulator now. Dec 31, 2009 at 19:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .