3

I am trying to develop my first Android app through the ADT plugins for Eclipse. I have downloaded and installed both ADT and the Android SDK and have created a HelloAndroid Android project. I created a new AVD called HelloAndroidEmulator1 just for testing my HelloAndroid app.

When I go to run my project (rooted at HelloAndroidActivity.java which was autogenerated for me), I'm getting some bizarre errors. I have not changed any of the source code that Eclipse generated for me, and have not added any of my own code. I'm simply trying to compile and run what was autogenerated.

When I look in the layout/main.xml file's Graphical Layout, I see a rendering of my app displaying the text:

HelloAndroid

Hello World, HelloAndroidActivity!

Where HelloAndroid is the name of my Eclipse project and HelloAndroidActivity is the name of my main driver that Eclipse makes for me.

When I go to actually run the application, I do not get anything like that output at all. The emulator loads up, and after about 60 seconds of displaying the startup "android" splash screen, it starts to load up but then gives me an error:

Launcher is not responding. Would you like to close it?

Back inside Eclipse, my console output looks like this (after I've closed the launcher):

[2012-01-03 11:23:23 - HelloAndroid] ------------------------------
[2012-01-03 11:23:23 - HelloAndroid] Android Launch!
[2012-01-03 11:23:23 - HelloAndroid] adb is running normally.
[2012-01-03 11:23:23 - HelloAndroid] Performing       net.me.myprojects.android.proj.HelloAndroidActivity activity launch
[2012-01-03 11:23:23 - HelloAndroid] Automatic Target Mode: Preferred AVD 'HelloAndroidEmulator1' is not available. Launching new emulator.
[2012-01-03 11:23:23 - HelloAndroid] Launching a new emulator with Virtual Device 'HelloAndroidEmulator1'
[2012-01-03 11:23:36 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error
[2012-01-03 11:23:36 - HelloAndroid] New emulator found: emulator-5554
[2012-01-03 11:23:36 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2012-01-03 11:25:00 - HelloAndroid] HOME is up on device 'emulator-5554'
[2012-01-03 11:25:00 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554'
[2012-01-03 11:25:00 - HelloAndroid] Installing HelloAndroid.apk...
[2012-01-03 11:27:03 - HelloAndroid] Failed to install HelloAndroid.apk on device 'emulator-5554!
[2012-01-03 11:27:03 - HelloAndroid] (null)
[2012-01-03 11:27:03 - HelloAndroid] Failed to install HelloAndroid.apk on device 'emulator-5554': EOF
[2012-01-03 11:27:03 - HelloAndroid] com.android.ddmlib.InstallException: EOF
[2012-01-03 11:27:03 - HelloAndroid] Launch canceled!

I tried searching online but couldn't find anything that jumped out as being the clear culprit. I must not have something installed or configured correctly, but I can confirm that:

  • ADT is installed inside Eclipse
  • The SDK is installed under C:\Users\me\android-sdk
  • I can open and edit both the SDK and AVD Managers

Edit: Here is the source for HelloAndroidActivity.java:

package net.me.myprojects.android.proj;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroidActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

Any ideas as to what is happening here?!?! Thanks in advance!

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756

5 Answers5

5

Make sure your Virtual Device has a valid SD card size (i.e. bigger than 0)

Luis Valdés
  • 1,409
  • 1
  • 12
  • 12
3

Try few fixes:

  1. Shut down the emulator and the IDE and relaunch the application.
  2. Window -> Android SDK and AVD Manager -> Create a new AVD manager with different name and launch it.

If this doesn't work then give me your HelloAndroidActivity class. I will try to run it on my machine and will see.

Add text view to it..

public class HelloAndroidActivity 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);
   }
}

If you are still getting any error follow this tutorial. Android Tutorial

Sanjay Kumar
  • 1,474
  • 14
  • 22
  • Thanks Sanjay. I did what you suggested and am getting the same error with the 2nd emulator. Please see my edit which includes the source for `HelloAndroidActivity`. Thanks again! – IAmYourFaja Jan 03 '12 at 17:44
  • I believe we cannot create new AVD managers with different names whenever we get this error. There has to be a better way. Also I agree with IAmYourFaja. – LearningEveryday Jun 19 '14 at 07:05
1

For me, the error went away on its own after trying to re-run multiple times. Possibly the system filtered itself of some old copy in memory after a while.

GeekedOut
  • 16,905
  • 37
  • 107
  • 185
1

I had the same error while I was working with a new App which used SQLite.

Anyways, the issue was that even after you close your Eclipse and Emulator.. in Task Manager the process adb.exe or abd.exe*32 was still running.

Steps:
1. Close eclipse and emulator.
2. Kill the process adb.exe or abd.exe*32.
3. Start your eclipse, clean build your app once and its almost like new.

Happy coding.

LearningEveryday
  • 584
  • 1
  • 3
  • 13
0

Start the emulator manually and check whether your app is installed. If its installed just delete it and retry to launch your app with eclipse.

  • Gingerbread - how do I find my AVDs so I can run the emulator from the command line? – IAmYourFaja Jan 03 '12 at 17:46
  • Just go to the app drawer in your emulator, that´s where all apps are listed. Then look for your activity. If its already installed just start or delete it. – Gingerbread123321 Jan 03 '12 at 17:52
  • Gingerbread - when I try to launch the emulator via: `emulator.exe @HelloAndroidEmulator2` I get an error message: `PANIC: Could not open C:\path\to\android-home\avd\HelloAndroidEmulator2.avd.ini – IAmYourFaja Jan 03 '12 at 17:55
  • I guess I don't even know how to launch the emulator to get my "app drawer" in the first place... – IAmYourFaja Jan 03 '12 at 17:56
  • Oh...than the error isnt related to your source code and your app at all. Try to start SDK Manager and search for new upadtes and install all. Maybe that will help... – Gingerbread123321 Jan 03 '12 at 18:16
  • The only updates it lists are for other APIs, which I'm pretty sure I don't need/want. – IAmYourFaja Jan 03 '12 at 18:33