简体   繁体   中英

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.

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 (eg 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

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). 任务管理器的截图

(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 - ie 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...

I have the similar problem. I suggest the following workaround:

  1. close eclipse, in the Task Manager, kill all adb and emulator* processes.
  2. start eclipse, run your application, wait untill the emulator starts. If you have the problem, your application won't be started, there will be the bare emulator.
  3. In eclipse, select Window->Open Perspective->Other->DDMS. Switch to DDMS perspective. If you have the problem, the list of the devices will be empty.
  4. In the Devices tab, in the drop-down box, select "reset adb". In a short while, the emulator must appear in the devices list.
  5. Following that, switch back to your Java perspective and run your app. Everything must work fine for the rest of the session.

Actually, if you are using Windows, the problem might be that the User Account Control in your Windows is preventing Eclipse to load the apk in the emulator (Eclipse doesn't have right to do so).

To turn off the User Account Control, go to the Control Panel, click User Accounts and Family Safety, and then click User Accounts. Once there, click the option 'Turn User Account Control on or off'.

In my case the problem occurs because of the simple thing: i do not select the project that i want to run. Click on it in solution folder, then press run and enjoy. Hope it will help someone.

Depending on your computer it can takes several minutes to load the emulator and the app. Open Logcat view to see the progress of loading.

Same problem. Killing adb from task manager didn't help. Also tried restarting the AVD using android create avd --target 2 --name my_avd --force, no good. Tried the different launch method in Eclipse, nada.

What eventually helped is: I started (from the start menu, not command line) the Android SDK Tools > SDK Manager, found the my_avd under virtual devices, and simply clicked the Start... button. That did it - the emulator started, I ran from Eclipse, and it immediately showed the app on the emulator.

One solution is go to android sdk/tools directory and start ddms.bat for Dalvik Debug Monitor, then select Actions->Reset adb. That seem to fix the problem

STEPS TO FOLLOW:

  1. Go to Command Prompt
  2. type adb kill-server
  3. enter

Now it should work fine

The Android emulator takes approximately 1 to 2 mins to load. Check the console tab in the eclipse IDE for evaluating the progress of loading the emulator and installing the application in the emulator.

I used to face this problem a lot. There is workaround for this,

End the "adb.exe" process from the Task Manager and try again.

It should work. and instead of running from eclipse i use following batch files in my project directory to install and uninstall the apk. Those work great.

Install.bat

cd bin
adb install *.apk

Uninstall.bat

adb uninstall this.is.package.name

For me the solution was to choose "app" instead of "RSSReader" (my project name) in the dropdown next to the AVD tray. When I choose "RSSReader", the AVD is greyed out and unusable.

This leads me to wonder if my project is setup wrong or if "app" is the correct state.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM