在 Eclipse 的 运行 'Hello world' android 应用程序上遇到一些错误

Facing some errors on running 'Hello world' android app from Eclipse

我正在 Eclipse(Luna Service Release 1 (4.4.1))中构建第一个 android 应用程序。我在系统上下载了所有 Eclipse 插件和 AVD(参考截图)。

当我运行出现以下错误
无法在设备“emulator-5554!”上安装HelloWorldAndriodApp.apk (无效的) 发布已取消!

我在 google(包括 Stack Overflow)上经历过许多与此类似的 link 并尝试了解决方案 1. 将 ADB 连接超时增加到 500000 2. 清理构建应用程序 3. 重置 ADB 在所有这些练习之后,我开始遇到另一个异常
[2015-11-30 12:50:19 - HelloWorldAndriodApp] 安装错误:未知故障 [2015-11-30 12:50:19 - HelloWorldAndriodApp] 请检查 logcat 输出以获取更多详细信息。 [2015-11-30 12:50:23 - HelloWorldAndriodApp] 发布已取消!

由于所有这些错误,我的应用程序没有初始化,只能看到模拟器屏幕中间带有 'Android' 文本的黑屏。

请提出一些解决方案来消除这些错误。

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.example.helloworldandriodapp"
        android:versionCode="1"
        android:versionName="1.0" >
        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="16" />
        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name=".MainActivity"
                android:label="@string/app_name" >
            </activity>
        </application>
    </manifest>

Java Class

public class MainActivity extends ActionBarActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }
    }

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.helloworldandriodapp.MainActivity" >

    <TextView
        android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true"
      android:text="@string/hello_world"
      tools:context=".MainActivity" />    
</RelativeLayout>

strings.xml

<resources>
    <string name="name">Type your name</string>
    <string name="app_name">HelloWorldAndriodApp</string>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="menu_settings">Settings</string>
   <string name="title_activity_main">MainActivity</string>
</resources>

登录目录:

11-30 00:44:44.080: E/EGL_emulation(2502): Failed to establish connection with the host
11-30 00:44:44.180: E/(2502): Failed to connect to host (QemuPipeStream)!!!
11-30 00:44:44.180: E/EGL_emulation(2502): Failed to establish connection with the host
11-30 00:44:44.200: E/(2502): Failed to connect to host (QemuPipeStream)!!!
11-30 00:44:44.200: E/EGL_emulation(2502): Failed to establish connection with the host
11-30 00:44:44.220: E/(2502): Failed to connect to host (QemuPipeStream)!!!
11-30 00:44:44.220: E/EGL_emulation(2502): Failed to establish connection with the host
11-30 00:44:44.220: E/(2502): Failed to connect to host (QemuPipeStream)!!!
11-30 00:44:44.260: E/EGL_emulation(2502): Failed to establish connection with the host
11-30 00:45:26.580: E/PowerManagerService-JNI(2784): Couldn't load power module (No such file or directory)
11-30 00:45:57.330: E/memtrack(2804): Couldn't load memtrack module (No such file or directory)
11-30 00:45:57.330: E/android.os.Debug(2804): failed to load memtrack module: -2
11-30 00:46:12.840: E/SurfaceFlinger(55): ro.sf.lcd_density must be defined as a build property

代码没问题,应该可以,问题一定出在模拟器上。

PS:此外,我建议使用 Android Studio 进行 Android 开发。我最近开始使用它,让一切变得更加简单。