Search code examples
androidmobile-application

Cannot able to run my application?


I'm following the book "Professional Android 2 Application Development" by Reto Meier. I created the "HelloWorld" project. I use Eclipse as an IDE. If I run the application then the simulator starts but my application cannot run. he following information is displayed in the console:

[2011-07-03 16:03:28 - Hello_world] ------------------------------
[2011-07-03 16:03:28 - Hello_world] Android Launch!
[2011-07-03 16:03:28 - Hello_world] adb is running normally.
[2011-07-03 16:03:28 - Hello_world] Performing com.paad.HelloWorld.Hello_worldActivity activity launch
[2011-07-03 16:03:28 - Hello_world] Automatic Target Mode: Preferred AVD 'device2_1' is not available. Launching new emulator.
[2011-07-03 16:03:28 - Hello_world] Launching a new emulator with Virtual Device 'device2_1'
[2011-07-03 16:03:56 - Hello_world] New emulator found: emulator-5554
[2011-07-03 16:03:56 - Hello_world] Waiting for HOME ('android.process.acore') to be launched...
[2011-07-03 16:05:12 - Hello_world] emulator-5554 disconnected! Cancelling 'com.paad.HelloWorld.Hello_worldActivity activity launch'!

I cannot understand why my application is not able to run.


Solution

  • Did you wait until the emulator finished starting? The log you posted may indicate that you closed the emulator before it started up. The start takes a while, depending on the device configuration you have chosen (up to 5 minutes for me, if I try to launch a tablet emulator). While starting, it goes to a small text saying "android" to an android text-logo and after that its usually up

    And did you unlock them emulator? The emulator behaves like a real phone, there is the usual key-lock in place. You have to release that first, depending on the android version your are using you either have to drag a handle sideways or press the menu key (e.g. in Android 1.6). If the phone is locked, you cant launch your app. There should be some info text on the screen telling you what to do.

    After you got that, try to run your app again. It should start. Please note that you can leave the emulator open once you started it. If you run your application, the newest version will always be uploaded into the emulator and executed. No need to restart the emulator all the time (which takes ages).