Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Emulator won't run application started from eclipse

I have followed the "Hello World" example from Google's Android developer's guide. When I try to run the application in the SDK emulator, nothing happens. The emulator startd up nicely, but after that nothing happens. I can't even see the application in the app tray.

I am using Eclipse with the Android add-on installed.

like image 285
Christian Tang Avatar asked May 08 '10 11:05

Christian Tang


People also ask

Why Android Emulator is not opening?

If the Android Emulator does not start properly, this problem is often caused by problems with HAXM. HAXM issues are often the result of conflicts with other virtualization technologies, incorrect settings, or an out-of-date HAXM driver. Try reinstalling the HAXM driver, using the steps detailed in Installing HAXM.

How do I run an eclipse emulator?

In order to run an instance of the emulator, you must create an AVD. To create an AVD from Eclipse: Select Window > Android SDK and AVD Manager, or click the Android SDK and AVD Manager icon in the Eclipse toolbar. In the Virtual Devices panel, you'll see a list of existing AVDs.

How do I run an APK file on an emulator?

This method is much simpler than 1st method. We just need the APK file to install it in the Emulator. First of all, we still have to open the Emulator and after that drag, your APK file and drop it in the emulator anywhere and that's it it will simply install that app in the Emulator.

How do I enable Android Emulator in Visual Studio?

Just open up the Visual Studio Emulator for Android entry in your Start Menu, hit play, and the emulator is ready to debug from any IDE. Download the standalone emulator today!


2 Answers

Had the same problem, the console log stalled after:

Launching a new emulator with Virtual Device

and the emulator never showed the HelloAndroid application. I finally figured it out! In Eclipse go to

Run --> Run Configurations

Then change the Launch Action for your application (e.g. HelloAndroid) from "Launch Default Activity" to "Launch:" and then select your application from the pull-down menu. This did the trick for me.

HTH, Sven

like image 86
Sven Boehringer Avatar answered Oct 02 '22 03:10

Sven Boehringer


Same here; emulator loads fine but apk doesn't get installed. Problem is only with the emulator. All works fine if physically connecting a device with USB debugging turned on.

NB This suddenly started happening for no apparent reason. All used to work fine.

I've tried uninstalling and reinstalling the ADT Plugin and I've updated the Android SDK and AVD Manager to the latest available. (Tools revision 7) but the problem continues.

Eclipse: Helios Service Release 1 Build id: 20100917-0705 Running on Windows XP SP2

Just as others have posted, the console log shows

[2010-10-14 11:39:33 - uad-MediaPlayerExample] ------------------------------ [2010-10-14 11:39:33 - uad-MediaPlayerExample] Android Launch! [2010-10-14 11:39:33 - uad-MediaPlayerExample] adb is running normally. [2010-10-14 11:39:33 - uad-MediaPlayerExample] Performing com.msi.manning.chapter10.MediaPlayerExample.MediaPlayerActvity activity launch [2010-10-14 11:39:33 - uad-MediaPlayerExample] Automatic Target Mode: launching new emulator with compatible AVD '1.6-hvga' [2010-10-14 11:39:33 - uad-MediaPlayerExample] Launching a new emulator with Virtual Device '1.6-hvga' 

LogCat remains empty/blank.

And if I then try to re-run the same app, the console shows:

[2010-10-14 11:39:33 - Emulator] emulator: ERROR: the user data image is used by another emulator. aborting 

POSSIBLE ANSWER??? One solution seems to be to kill the adb.exe process in Windows Task Manager (while the emulator is still running). screenshot of task manager

(from http://vikashazrati.wordpress.com/2008/01/01/quicktip-android-does-not-load-my-application-in-the-emulator/)

The console suddenly shows lots of errors:

[2010-10-14 12:12:00 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host [2010-10-14 12:12:01 - DeviceMonitor]Sending Tracking request failed! [2010-10-14 12:12:01 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host [2010-10-14 12:12:02 - DeviceMonitor]Sending Tracking request failed! [2010-10-14 12:12:02 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host [2010-10-14 12:12:03 - DeviceMonitor]Sending Tracking request failed! [2010-10-14 12:12:03 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host [2010-10-14 12:12:04 - DeviceMonitor]Sending Tracking request failed! [2010-10-14 12:12:04 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host [2010-10-14 12:12:05 - DeviceMonitor]Sending Tracking request failed! [2010-10-14 12:12:05 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host [2010-10-14 12:12:06 - DeviceMonitor]Sending Tracking request failed! [2010-10-14 12:12:06 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host 

but the app starts in the emulator. !!!

(as expected the LogCat also suddenly starts to display lots of messages)

All works fine - i.e. you can work on your code and re-run the app in the same emulator and it reinstalls as expected...

BUT if you close the emulator, you see the following console error:

[2010-10-14 12:15:05 - DeviceMonitor]Sending jdwp tracking request failed! 

And the same problem reoccurs - a new emulator appears but the apk isn't installed. So you need to go back to Windows Task Manager and once again kill the adb.exe process.

NB I find that adb.exe doesn't reappear in the Task Manager unless I restart Eclipse, so after closing an emulator you have to restart Eclipse, try Run (which fails to display the app) then go back to the Task Manager where adb.exe is once again listed and kill the process for the app to start.

Would be great if someone could provide an explanation for this and a permanent fix...

like image 26
baroquedub Avatar answered Oct 02 '22 03:10

baroquedub