简体   繁体   English

在Eclipse上运行Android程序时出现问题

[英]Issue with Running Android Program on Eclipse

I downloaded complete Android Environment Development Environment Snapshots from marakana.com . 我从marakana.com下载了完整的Android Environment Development Environment快照 I start eclipse and create new Android project. 我开始eclipse并创建新的Android项目。 On the Run Configurations , i created New Configuration to run the application, and set the Target to Automatic and select the AVD that appropriate to run the application. 在“ Run Configurations ,我创建了“新配置”以运行该应用程序,并将“目标”设置为“ Automatic然后选择适合于运行该应用程序的AVD。 But, when i click on the run icon, it starts the new emulator, and after some minutes, just android emulator be ran and my application doesn't run on it. 但是,当我单击运行图标时,它将启动新的模拟器,几分钟后,仅运行了android模拟器,并且我的应用程序未在其上运行。

What do i do to solve the running problem and run my project on emulator ? 我该如何解决正在运行的问题并在模拟器上运行我的项目?

NOTE 1 : Console outputs : 注1 :控制台输出:

[2012-03-07 16:03:49 - New] ------------------------------
[2012-03-07 16:03:49 - New] Android Launch!
[2012-03-07 16:03:49 - New] adb is running normally.
[2012-03-07 16:03:49 - New] Performing com.android.example.NewActivity activity launch
[2012-03-07 16:03:53 - New] Launching a new emulator with Virtual Device 'Device'
[2012-03-07 16:04:00 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error

NOTE 2 : My Program Source: 注意2 :我的程序来源:

package com.android.example;

import android.app.Activity;
import android.os.Bundle;

public class NewActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

Thanks for your attention :) 感谢您的关注 :)

To start an Activity it needs an intent-filter like this: 要启动一个活动,它需要一个如下的意图过滤器:

<activity android:name=".NewActivity">
  <intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
  </intent-filter>
</activity>

Depending on your package name you can start it from the command line like this: 根据您的软件包名称,您可以从命令行启动它,如下所示:

adb shell am start -n your.package.name/.NewActivity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM