views:

264

answers:

2

Before u start: I searched the google and stackoverflow, none of them gave clear answer.

Situation: I'm using Eclipse on Windows to develop Android application. So when I'm trying to run the app, the system outputs to console

[2010-06-14 17:04:39 - HelloLinearLayout] ------------------------------
[2010-06-14 17:04:39 - HelloLinearLayout] Android Launch!
[2010-06-14 17:04:39 - HelloLinearLayout] adb is running normally.
[2010-06-14 17:04:39 - HelloLinearLayout] Performing com.example.HelloLinearLayout.HelloLinearLayout activity launch
[2010-06-14 17:04:39 - HelloLinearLayout] Automatic Target Mode: launching new emulator with compatible AVD 'Default_2.1'
[2010-06-14 17:04:39 - HelloLinearLayout] Launching a new emulator with Virtual Device 'Default_2.1'

starts the emulator, but doesn't upload the .apk and doesn't start the activity. So, app is not started anyway.

I found a "solution" here, but it's unclear and seems to not work. For example, I don't know, which "emulator processed" are meant to be killed. I found adb.exe only. And that's the main point: sometimes I'm lucky enough to kill all that they wanted and start the app. But it's undetermined.

Please help, I'm completely stuck with this trouble.

+1  A: 

I've run into this situation many times and have had to do several things to resolve the issue.

1) If DDMS is running, close it (it seems to interfere with debugging sometimes).

2) Start the emulator, try connecting with DDMS, then disconnect, then go back to eclipse and start the debuggerer.

3) Kill the emulator, kill the adb process in task manager, restart eclipse, then try debugging letting Eclipse launch the emulator, sometimes the first load of the emulator times out so when it's fully started up, start debugging again.

Overall though, I've found it is much easier to not use the emulator and use an actual device, for me it's a much faster process.

skirmish
A: 

Thanks for the help - so even with the Android 2.2 platform this is still the accepted way to operate the emulator? i.e. 1, 2, 3 as described above. I am having a similar problem on WinXP with Eclipse w/ ADT plugin. Why would the activity not be able to start on the emulator? The computer has 756MB RAM if that could be the problem. The deployment is going along until Eclipse tries to deploy the activity. The emulator starts with the text "ANDROID_" and then eventually just displays the ANDROID logo, though appears to still be running just fine. Any ideas? Thanks. The code was copied from the HelloWorld tutorial. Here is the Eclipse console log including the error messages towards the end:

[2010-06-23 15:43:26 - myHelloWorldProject] ------------------------------ [2010-06-23 15:43:26 - myHelloWorldProject] Android Launch! [2010-06-23 15:43:26 - myHelloWorldProject] adb is running normally. [2010-06-23 15:43:27 - myHelloWorldProject] Performing net.concentricllc.HelloWorld.HelloAndroid activity launch [2010-06-23 15:43:27 - myHelloWorldProject] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'myHelloWorldAVD' [2010-06-23 15:43:27 - myHelloWorldProject] WARNING: Application does not specify an API level requirement! [2010-06-23 15:43:27 - myHelloWorldProject] Device API version is 8 (Android 2.2) [2010-06-23 15:43:27 - myHelloWorldProject] Uploading myHelloWorldProject.apk onto device 'emulator-5554' [2010-06-23 15:43:32 - myHelloWorldProject] Installing myHelloWorldProject.apk... [2010-06-23 15:48:29 - myHelloWorldProject] Success! [2010-06-23 15:48:37 - myHelloWorldProject] Starting activity net.concentricllc.HelloWorld.HelloAndroid on device [2010-06-23 15:51:35 - myHelloWorldProject] Device not ready. Waiting 3 seconds before next attempt. [2010-06-23 15:51:36 - myHelloWorldProject] ActivityManager: android.util.AndroidException: Can't connect to activity manager; is the system running? [2010-06-23 15:51:38 - myHelloWorldProject] Starting activity net.concentricllc.HelloWorld.HelloAndroid on device [2010-06-23 15:53:36 - myHelloWorldProject] Device not ready. Waiting 3 seconds before next attempt. [2010-06-23 15:53:36 - myHelloWorldProject] ActivityManager: android.util.AndroidException: Can't connect to activity manager; is the system running? [2010-06-23 15:53:39 - myHelloWorldProject] Starting activity net.concentricllc.HelloWorld.HelloAndroid on device [2010-06-23 15:55:41 - myHelloWorldProject] Device not ready. Waiting 3 seconds before next attempt. [2010-06-23 15:55:41 - myHelloWorldProject] ActivityManager: android.util.AndroidException: Can't connect to activity manager; is the system running? [2010-06-23 15:55:44 - myHelloWorldProject] Starting activity net.concentricllc.HelloWorld.HelloAndroid on device [2010-06-23 15:57:15 - myHelloWorldProject] Device not ready. Waiting 3 seconds before next attempt. [2010-06-23 15:57:15 - myHelloWorldProject] ActivityManager: android.util.AndroidException: Can't connect to activity manager; is the system running? [2010-06-23 15:57:18 - myHelloWorldProject] Starting activity net.concentricllc.HelloWorld.HelloAndroid on device [2010-06-23 15:58:51 - myHelloWorldProject] ActivityManager: Error type 2 [2010-06-23 15:58:52 - myHelloWorldProject] ActivityManager: android.util.AndroidException: Can't connect to activity manager; is the system running?

Andy P.
The emulator takes a long time to start, and quite often the first invocation times out. At this point, I wait for the emulator to fully start up, wait a minute (open the app drawer, force close things that inevitably crash on emulator startup on a slow machine), then once the emulator is fully up and running, then I go back to eclipse to launch the app. I think the timeout in eclipse is too small for that initial launch of the emulator.
skirmish
@skirmish - thanks for the reply, this helped a lot. Time for an upgrade for me! It's probably running out of memory: Pentium 4, 2.8GHz, 756 MB RAM. I'll try again after the upgrade and let you know.Best regards,Andy
Andy P.