我正在Eclipse中構建第一個android應用程序(Luna Service Release 1(4.4.1))。我在系統上下載了所有Eclipse插件和AVD(請參閱截圖)。在Eclipse上運行'Hello world'android應用程序時遇到一些錯誤
當我跑到下面出錯
無法在設備上安裝HelloWorldAndriodApp.apk「模擬器 - 5554! (空) 發佈取消!
我已經通過在谷歌類似這樣的很多鏈接了(包括堆棧溢出),並也嘗試瞭解決方案1.增加亞行連接超時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類
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
發佈您的代碼。如果你把你的日誌貓異常的細節,它會更容易理解。 –
切換到Android Studio –
你在設備上測試過嗎? –