• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Emulator won't run hello world app

Oobleck

Lurker
I'm just getting started with Android programming, using Eclipse 3.7.1 and ADT 16.0.1. Naturally I started with the usual Hello World program. It runs fine on a physical device, but not on the emulator. When I run it on an AVD, here's what the console window says:

[2012-01-27 17:02:29 - HelloAndroid] ------------------------------
[2012-01-27 17:02:29 - HelloAndroid] Android Launch!
[2012-01-27 17:02:29 - HelloAndroid] adb is running normally.
[2012-01-27 17:02:29 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2012-01-27 17:02:42 - HelloAndroid] Launching a new emulator with Virtual Device 'AVD_4.0.3'
[2012-01-27 17:02:51 - Emulator] emulator: warning: opening audio input failed
[2012-01-27 17:02:51 - Emulator]
[2012-01-27 17:02:54 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error

That's all. The emulator starts up and appears to be working OK, but the app never shows up on it.

I can also start the AVD from the AVD manager window, and again it starts and runs OK. But if I try to run my app, the emulator doesn't show up in the list of running Android devices in the device chooser -- I assume it should, since there's a column headed "AVD name".

Any thoughts on what I'm doing wrong here? Thanks.
--
oobleck
 
If you have any firewalls enabled (including any that are part of the operating system or part of a security package) try temporarily disabling it.
 
Is there anything non-standard about your setup?

I'll presume you're using Windows and have installed the AndroidSDK in C:\AndroidSDK, adjust the commands below accordingly if not. (I'm on Mac OS X, so I hope I've translated these command for you correctly.)


Try running these command in a command prompt:
Code:
cd C:\AndroidSDK\platform-tools
adb version
adb kill-server
adb start-server

I get the following output:
Code:
C:\> [B]cd C:\AndroidSDK\platform-tools[/B]

C:\AndroidSDK\platform-tools> [B]adb version[/B]
Android Debug Bridge version 1.0.29

C:\AndroidSDK\platform-tools> [B]adb kill-server[/B]

C:\AndroidSDK\platform-tools> [B]adb start-server[/B]
* daemon not running. starting it now on port 5037 *
* daemon started successfully *


Try starting an emulator via the AVD manager and then try running:
Code:
adb devices

I get the following output:
Code:
C:\AndroidSDK\platform-tools> [B]adb devices[/B]
List of devices attached 
emulator-5554	device


Try connecting to the emulator's shell and issuing a shell command:
Code:
adb shell
ls
exit

I get the following output:
Code:
C:\AndroidSDK\platform-tools> [B]adb shell[/B]
# [B]ls[/B]
acct
cache
config
d
data
default.prop
dev
etc
init
init.goldfish.rc
init.rc
mnt
proc
root
sbin
sdcard
sys
system
ueventd.goldfish.rc
ueventd.rc
vendor
# [B]exit[/B]

C:\AndroidSDK\platform-tools>
 
Is there anything non-standard about your setup?

I'll presume you're using Windows and have installed the AndroidSDK in C:\AndroidSDK, adjust the commands below accordingly if not. (I'm on Mac OS X, so I hope I've translated these command for you correctly.)

The SDK is installed under the Program Files folder; is that a problem? Like, is having a space in the path a no-no?

Try running these command in a command prompt:
Code:
cd C:\AndroidSDK\platform-tools
adb version
adb kill-server
adb start-server

I ran the various commands that you suggested, and here's what I've found. If I start an AVD from the AVD manager, it doesn't show up in the ADB device list. But if I execute "adb kill-server" and "adb start-server", then the AVD shows up in the device list. At that point I can connect to the shell and run the ls command, which gives the same result you listed. I can also run the app from Eclipse, select the AVD in the device chooser, and it installs and runs on the AVD like it should.

If I shut down and restart the AVD, I have to do the "adb kill-server" and "start-server" before the AVD will show up in the device list again.

I assume there's a problem with the ADB starting up, but I don't know what to do about it.

Thanks for the help!
--
oobleck
 
Back
Top Bottom