Reputation: 4354
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.
Upvotes: 0
Views: 347
Reputation:
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).
Upvotes: 3
Reputation: 1202
You could post your code so we can see possible problems.
You can also look at warnings and errors with LogCat (Window > Open Perspective > Other... > DDMS or something). Then use Log.d or Log.e in your code so you can trace how far it gets before messing up.
Upvotes: 1
Reputation: 54806
Android has some very good official documentation and tutorials. I suggest you try starting with the "official" Hello World example. I started there with my first Android app, and it worked as advertised for me.
Upvotes: 1