Android 应用程序无法在模拟器上启动

2023-12-01

我只是按照这个设置eclipse开始android开发http://developer.android.com/sdk/installing.html。我的问题似乎与此类似:Android 应用程序无法在模拟器上启动,但该解决方案不起作用。我正在尝试运行一个简单的 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);
   }
}

这是清单:

<?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 活动。如果这不起作用,请右键单击该项目,然后检查运行配置。您可以选择设置要启动的活动。

此外,您应该能够在模拟器启动器的应用程序抽屉中看到应用程序的图标。单击该图标并查看应用程序是否启动。如果没有,那么问题就出在你的活动上(尽管我没有发现任何问题)。

如果这两个不起作用,请尝试从命令提示符重新启动 adb:

>adb kill-server
>adb start-server
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android 应用程序无法在模拟器上启动 的相关文章

随机推荐