我就是按照这个http://developer.android.com/sdk/installing.html设置eclipse开始android开发的.我的问题似乎与此类似:Android app not launching on emulator ,但解决方案将不起作用。我正在尝试运行一个简单的 hello 应用程序。我没有收到任何错误,但这是控制台:
[2011-06-01 10:03:53 - HelloAndroid] ------------------------------
[2011-06-01 10:03:53 - HelloAndroid] Android Launch!
[2011-06-01 10:03:53 - HelloAndroid] adb is running normally.
[2011-06-01 10:03:53 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2011-06-01 10:04:00 - HelloAndroid] Launching a new emulator with Virtual Device 'AVD2.2'
这是我的小代码:
package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
这是 list :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloandroid"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloAndroid"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
模拟器启动并转到我可以解锁它的屏幕。模拟器似乎可以工作,但该应用程序从未启动过。此外,当我运行模拟器并尝试通过单击运行方式重新启动应用程序时...Android 应用程序和一个弹出框要求我选择要启动的模拟器,但未显示正在运行的模拟器。
最佳答案
尝试添加
<category android:name="android.intent.category.DEFAULT" />
Eclipse 默认启动 DEFAULT Activity 。如果这不起作用,请右键单击该项目,然后检查运行配置。您可以选择设置要启动的 Activity 。
此外,您应该能够在模拟器启动器的应用程序抽屉中看到您的应用程序的图标。单击该图标并查看该应用程序是否启动。如果没有,那么问题出在您的 Activity 中(尽管我没有发现其中有任何问题)。
如果这两个都不起作用,请尝试从命令提示符重新启动 adb:
>adb kill-server
>adb start-server
关于Android 应用程序无法在模拟器上启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6203581/