I am building an first android app in Eclipse (Luna Service Release 1 (4.4.1)). I downloaded all Eclipse plugins along with AVD on system (Refer screenshot).
When I ran below error occured
Failed to install HelloWorldAndriodApp.apk on device 'emulator-5554!
(null)
Launch canceled!
I have gone through many link similar to this on google(incl. Stack Overflow) and also tried the solutions 1. Increased the ADB connection timeout to 500000
2. Clean build the application 3. Reset ADB
After all this exercise i started getting another exception
[2015-11-30 12:50:19 - HelloWorldAndriodApp] Installation error: Unknown failure
[2015-11-30 12:50:19 - HelloWorldAndriodApp] Please check logcat output for more details.
[2015-11-30 12:50:23 - HelloWorldAndriodApp] Launch canceled!
Due to all these error my application is not initializing and see only black screen with 'Android' text in the middle of the screen of emulator.
Please suggest some solution to get rid of these errors.
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>
Log Cat:
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
The code is fine, should work, the problem must be with the emulator.
PS: Also, I recommend using Android Studio for Android development. I recently started using it and makes everything so much easier.