开发者

How to launch an android application in eclipse

So I've done the "Hello, World" tutorial on the android developer site. Instructions on how to launch the application:

1) Select Run > Run. 2) Select "Android Application".

Simple enough. Except what starts is the android default launcher, not the application. How do I get the actual application to start?

Code is a copy paste from: http://developer.android.com/resources/tutorials/hello-world.html

Edit: Haven't tried logcat yet, but the console gives me:

[2011-08-23 15:57:19 - HelloAndroid] Android Launch!
[2011-08-23 15:57:19 - HelloAndroid] adb is runni开发者_开发问答ng normally.
[2011-08-23 15:57:19 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2011-08-23 15:57:19 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'MyPhone'
[2011-08-23 15:57:19 - HelloAndroid] Launching a new emulator with Virtual Device 'MyPhone'

Edit2: Apparently this is a known problem. The solution provided by google doesn't work for me, but might for someone else: http://developer.android.com/resources/faq/troubleshooting.html#eclipse

Edit3: I've found numerous people with the same problem, but no solutions so far. Workaround: use a physical device. The program runs fine on my Nexus One. I'm leaving the question for now, can't spend more time on this.


Right click to your project -> Run As -> Android Application


Right click on your project and select Run -> Run as -> Android Application.


Sometimes it doesn't start the application. You can launch the menu and you would see your application installed there. You can then manually launch the application.

Sometimes trying to run the application multiple times from Eclipse as well helps!


  • This may happen if another project (even a non Android project) is selected in your Eclipse workspace tree.

In that case, the Run command will be applied to this project even if a source file of HelloWord is opened on the edition screen.

Ensure that a source file of HelloWorld, or the project HelloWorld itself, is selected.

  • Or you may just need to unlock the Emulator that started.

When running the app from Eclipse, an emulator is started. But it appears locked. You have to unlock it to make the keyguard to disappear, as if it was an actual cellphone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜