Android Emulator won't run application started from eclipse - android

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

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

I have the similar problem. I suggest the following workaround:
close eclipse, in the Task Manager, kill all adb and emulator* processes.
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.
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.
In the Devices tab, in the drop-down box, select "reset adb". In a short while, the emulator must appear in the devices list.
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'.

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

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.

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

STEPS TO FOLLOW:
Go to Command Prompt
type adb kill-server
enter
Now it should work fine

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.

Related

Maven Sample Android App deploy fails constantly after one successful run

I downloaded the examples from simpligility.github.io/android-maven-plugin and did a mvn clean package android:deploy on the helloflashlight example.
After setting adbConnectionTimeout to 15000 everything went fine for one run. I deployed the app sucessfully - the app started on my device and I was able to push the color buttons.
After that I ran mvn android:undeploy to clean the device. Now I am not able to deploy this test app again. Maven says FAILURE "E/Device: Error during Sync: Eine vorhandene Verbindung wurde vom Remotehost geschlossen" Which means an open connection was closed by remote host(?).
I googled and found out that the problem may be 2 processes of adb.exe starting during deploy. So I entered adb kill-server and shut the adb down.
Still on each deploy 2 adb.exe are starting, one is shutting down immediatly, the other stays open. Searching for adb.exe at my computer only finds one adb.exe.
Does anybody have some hints for me?
My system setup:
I installed Eclipse with current ADT (Android Deploment Tools).
I used the Android SDK Manager to download and install android sdk and tools into C:\users\me\android-sdk. I added a samsung device to the device list which is displayed when I enter adb devices
After that I configured Maven for android - setting ANDROID_HOME and added %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools to my PATH.
I am working with Windows 7 64-bit.
It seemed to be a problem with the device. I switch to another device of same type... no problems any more.

reasons for emulator not opening after installing android in eclipse

I installed android in eclipse, everything is fine but after launching the AVD, emulator was not opening. At what situations it will happen? It was showing error like
[2012-07-19 17:09:04 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
Check out this -
"The connection to adb is down, and a severe error has occured."
as well
Error: "Adb connection Error:An existing connection was forcibly closed by the remote host"
Or you can do one thing give correct path of android-sdk-windows.
I had some problems with the emulator button in eclipse, too.
Some times it just wont't fire the emulator up. I actually have no guess why this is (maybe it opens up in another dimension where you can't see it :P).
I worket around this issue by simply not using the button ;).
I start the emulator manually.
On linux after creating your emulator configurations you can start an emulator from the command line.
In your Android SDK folder there is a subfolder "tools".
You can run the "emulator" program and give it the name of the AVD configuration as first argument.
emulator #My_AVD_Configuration_Name
You have to put the # token in front of the name.
Then you can install your APK file by using the "adb" program.
The "adb" program is in the "platform-tools" subfolder in your Android SDK.
Just write.
adb install -r MyAndroidApp.apk
I hope this helps a bit :)

Unable to upload file to device from eclipse

I'm running into an error where I can no longer upload/run my android app from eclipse on to a real device. I don't recall having changed anything particular that would cause this error. here's my error log from console in Eclipse:
[2011-05-25 16:58:01 - Child Protector] Android Launch!
[2011-05-25 16:58:01 - Child Protector] adb is running normally.
[2011-05-25 16:58:01 - Child Protector] Performing com.example.hello.Main activity launch
[2011-05-25 16:58:03 - Child Protector] Uploading Hello.apk onto device '982394670345'
[2011-05-25 16:58:09 - Child Protector] Failed to upload Hello.apk on device '982394670345'
[2011-05-25 16:58:09 - Child Protector] java.io.IOException: Unable to upload file: null
[2011-05-25 16:58:09 - Child Protector] Launch canceled!
I'm using Eclipse on Ubuntu 9.10. I've looked at the other threads and none of the methods worked (although their error log is slightly different). My adb logcat can't print anything, because the connection never was made (im guessing). I'm able to do a manual "adb install Hello.apk" and that is fine; but i do not want to have to do it each time from terminal (because i also don't know how to use the adb uninstall command - no clue where the file on phone is).
i've tried:
restarting computer
restarting phone
restarting eclipse
turning off and on Debugging mode
pulling and re-plugging USB cable to phone
also note, the app seems to be able to install on the emulator if i right click the project in Eclipse and select 'Run as -> Android App'. but won't work on my phone... I have an android 2.1 Samsung Galaxy S
Also, I'm relatively new to Android, so please provide details in explanation, as my knowledge is limited.
Go to Eclipse Preferences, then Android, then DDMS. Set the timeout value for ADB to 10000 ms.
You may have to create a new Eclipse project and copy everything over.

Android Failed to install HelloWorld.apk on device (null) Error

I am new to Android. When I am running my android application in eclipse I am getting these messages in the console:
[2011-03-08 12:57:35 - HelloWorld] ------------------------------
[2011-03-08 12:57:35 - HelloWorld] Android Launch!
[2011-03-08 12:57:35 - HelloWorld] adb is running normally.
[2011-03-08 12:57:35 - HelloWorld] Performing com.oreilly.helloworld.HelloWorldActivity activity launch
[2011-03-08 12:57:35 - HelloWorld] Automatic Target Mode: Preferred AVD 'MY_AVD' is not available. Launching new emulator.
[2011-03-08 12:57:35 - HelloWorld] Launching a new emulator with Virtual Device 'MY_AVD'
[2011-03-08 12:57:39 - HelloWorld] New emulator found: emulator-5554
[2011-03-08 12:57:39 - HelloWorld] Waiting for HOME ('android.process.acore') to be launched...
[2011-03-08 13:00:14 - HelloWorld] WARNING: Application does not specify an API level requirement!
[2011-03-08 13:00:14 - HelloWorld] Device API version is 11 (Android 3.0)
[2011-03-08 13:00:14 - HelloWorld] HOME is up on device 'emulator-5554'
[2011-03-08 13:00:14 - HelloWorld] Uploading HelloWorld.apk onto device 'emulator-5554'
[2011-03-08 13:00:14 - HelloWorld] Installing HelloWorld.apk...
[2011-03-08 13:02:22 - HelloWorld] Failed to install HelloWorld.apk on device 'emulator-5554!
[2011-03-08 13:02:22 - HelloWorld] (null)
[2011-03-08 13:02:23 - HelloWorld] Launch canceled!
How do I resolve the problems so that my application will launch?
Try changing the ADB connection timeout. I think it defaults that to 5000ms and I changed mine to 10000ms to get rid of that problem. If you are in Eclipse, you can do this by going through Window -> Preferences and then it is in DDMS under Android.
As described here: Android error: Failed to install *.apk on device *: timeout
Restarting the device works for me. Using adb install can get the apk installed, but it's annoying to use it everytime you launch the app when debugging within eclipse.
I get this from time to time, but it's usually related to the emulator being slow to start. Try again without closing the emulator between the retries. And if it still fails, please post the client logs (logcat).
Another reason can be a ghost Eclipse process running in background and still bound to the debugging port. Close eclipse, look at process list and see if there's still an Eclipse running. Kill all of them and restart Eclipse again.
If you are running it on an Android Emulator you do not want to close it between runs. The system will try to load the app and it will time out because of how long it takes the emulator to boot up. You can fix this by increasing the ADB time by going to Window -> Preferences -> Android -> DDMS and increasing the ADB time out (default is 5000ms) or by leaving the emulator open and just running it after the emulator is up and running.
I personally would recommend leaving the emulator open as it does load the apps relatively quickly once it is running, but it could be a drain on the system. Do whichever would help you more.
Something else you might want to consider is a hard reset of your emulator by wiping your user data.
In order to do this you:
- right click your project name in package explorer
- go to 'run as' then 'run configuration'
- in the 'run configuration' window click the 'target' tab
- then tick the name of your chosen emulator
- tick 'wipe user data', click apply
And the next time you start up your emulator it should prompt you asking whether you really want to wipe your data. Click yes, and hopefully it helps you to install the app.
I had the same problem and solved it by adding the paths of Android SDK folder tools and platform-tools to system PATH variable then restarting the device.
#Bolton 's answer worked for me.
Some details...
I got my phone a few weeks ago. I tried the HelloAndroid sample app right away (after installing req'd software, etc.). The app worked in the emulator AND on the phone--right away!
Shortly after that, I rooted my phone but did not flash any roms or kernels. I was only experimenting on the emulator until yesterday (writing a simple notepad app). When I tried debugging the app on the phone, here's what I observed:
Eclipse console reported the "...failed to install on device...(null)" message. BUT
The HelloAndroid app DID get pushed to the phone! (It appeared in the apps drawer AND I was able to launch it.)
It simply would not launch on the phone from the Eclipse run.
I searched around here and elsewhere last night (including this thread) with no luck. Finally, I rebooted my phone--which I never tried (doh!) 'cause I didn't think it would make a difference--and the app launched from an Eclipse start!
Still don't know the cause, but I'll come back here if I figure it out.
I have the same problem: Failed to install test.apk on device 'xxxxxxxxx': null
I try to reboot phone, restart Eclipse, and nothing!
Then, I remove this project from Eclipse workspace, and import again. (File, Import, Existing project to workspace). I do not know exactly what the problem was, but now is working ok.
I ran into the same problem and tried increasing the ADB connection timeout... Didn't work.
I tried putting the "android-sdk/tools" and "android-sdk/platform-tools" in the PATH variable.... No effect.
I tried restarting Eclipse and letting the AVD startup before running. Same problem.
I can sometimes get it to work with a combination of closing and reopening the project, followed by cleaning and rebuilding the project. It doesn't always work, but since I didn't restart the AVD this last time, I think the problem lies within Eclipse itself. You might try deleting everything in the "bin" directory of your project and then cleaning and rebuilding. It might be some temporary or intermediate files not getting deleted properly. Another thing I had to do was delete my AVD. It didn't delete properly, and I had to go in and manually delete the AVD's subfolder and then re-create the AVD. Some combination of these clears the problem up temporarily. Hope that helps.
If unplugging the device and plugging it back in doesn't work, try increasing the upload timeout to something really huge like 20000 ms. It's at Window → Preferences → Android → DDMS → "ADB connection time out (ms)".
Just try the following steps,
Go to Home screen before you start to run the application.
No need to uninstall every time. Just uninstall your application once properly.
Go to Setting -> Manage Application -> click menu -> filter -> Third party application.
Check whether your application is there or not.
After modifying your application just save it. Right click your project and select "Run as Android application".
Note: once again, before running your application check whether or not your emulator is showing the home screen.
going to home screen: from eclipse go to menus: window->android virtual device->start
As for me, I had the same problem and it helped to increase SD volume and max VM app heap size. (Android SDK and AVD manager - Virtual device - Edit)
What is interesting, the back change of SD and heap to the previous values is OK, too. That means, that any change of emulator parameters and its rebuilding is enough. (Simple restart won't help)
I had imported an existing project and started running...
i too was facing the same problem (WARNING: Application does not specify an API Device API version is 11 (Android 3.0) ). After all my attempts to resolve that failed,I just created new project under other package to maintain the same names and copied all the file contents of the previously imporetd projects manually and again started running...to my surprise it successfully executed in my first attempt...i think the problem was due to the lack of compatibilty of versions when imported...i hope it may help few...
I was facing this problem time and again.Got around a lot of forums, but couldn't find a logical solution for the issue.
I used to get this error message,
.
.
.
Uploading test.apk onto device 'emulator-5554'
Failed to install test.apk on device 'emulator-5554': timeout
Launch canceled!
this error is thrown as the start of emulator and deployment of application takes some significant time and before that the emulator times out.
A simple fix for this problem is keeping the emulator open when this problem occurs, *just run the application again. This only deploys the application on to the already started emulator *. There is not much time consumed during this run as the major part of the time during app deployment is because of slow start up of emulator.
Hope this helps!
What Jichao said always works for me.
Generally when I see this error if I am using Eclipse I will close and reopen the program. I will then uninstall the Application from the target phone. This sometimes fixes the issue but not always.
Next I will open up the command terminal and head into the android-sdk then run:
./adb install <AppName>.apk
This does the same thing that running through Eclipse does but it will give you an error message.
(9 times out of 10 it simply says 'INSTALL_ALREADY_EXISTS' and I go and uninstall the application off the target phone again then run adb and I am working fine.)
I was getting the same error.
I Just left the AVD running even after it says "Failed to install *.apk on device-emulator-5554". It automatically loaded the project afterwards.
I think the error comes due the slow start up of the AVD.
I was getting the same errors with my devices.
First be sure that you do not upload debug apk to a device having already installed the same apk but signed with release cert. In this case you've got to uninstall it first from the device.
In other cases my solution is to reboot everything:
reboot device
pskill emulator-arm.exe
pskill eclipse.exe
pskill adb.exe
After that the device, adb and eclipse are working.
When it shows the red writing - the error , don't close the emulator - leave it as is and run the application again.
restart the ADT or Try changing the ADB connection timeout. I think it defaults that to 5000ms and I changed mine to 10000ms to get rid of that problem. If you are in Eclipse, you can do this by going through Window -> Preferences and then it is in DDMS under Android.
OK, this approach will only be useful when you are connecting to a real device rather than to an Android emulator.
Resetting the DDMS ADB connection timeout won't work nicely with a real device when there is a problem with USB debugging mode of the device.
So, disabling and re-enabling USB debugging mode seems to resolve the issue by creating a new fresh ADB session on the device.
go setting- security verify apps if checked, change to unchecked status, then change to checked status
1) remove the apk from this directory project/build/outputs/apk
2) If you using genymotion emulator restart the genymotion
3) make project & rebuild the project
4) Run Again

Adb server not responding [duplicate]

This question already has answers here:
Eclipse error "ADB server didn't ACK, failed to start daemon"
(23 answers)
Closed 4 years ago.
I am a Android newbie. I guess I might be doing something stupid here. I have started the Virtual Device and I see that adbd daemon is running from the Terminal Emulator. When I run adb devices I get the following error:
C:\Program Files\Android\android-sdk\tools>adb devices
* daemon not running. starting it now on port 5037 *
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
No other process is using port 5037. What am I doing wrong? Here are the packages I have installed -
1) Android SDK Tools, revision 10
2) Android SDK Platform-Tools, revision 3
3) SDK Platform Android 2.3.3, API 10, revision 1
This will occur normally,if abd is not able to launch properly and didn't exit when adb kill-server is executed.
So if in Windows
1. Go to Task Manager (CTRL+ALT+DEL)
2.look for adb.exe and end the process.
Now restart the emulator ,should work properly.
additionally you can close and launch the development environment also (eg: Eclipse or NetBeans).
I suspect the problem is cause of many adb instances (in windows) , i usually face this problem cause i don't turn off my system so the adb process may not end properly.
So open task manager choose Process tab just search for adb.exe, right click on it and choose End Process Tree rather than just End Process
Had the same problem, it seems that my security solution was blocking adb.exe
this is not the right folder for adb : lately adb has moved from /tools to /platform-tools in the sdk folder.
Seems like the security program is blocking adb.exe, so go to the adb file path and open adb's properties, then check the Run this program as administrator setting.
In my case the process adb.exe starts when i connect the phone, and then when I adb devices then I have your problem, and killing the process does not help it is resurrecting like a stubborn zombie, as long as the phone is connected.
so my solution was to disconnect the phone, then kill adb.exe process, then start it by adb devices and connect the phone
After that when i command adb devices i ma getting the same prompt about killing adb out of date, but this time on the second line is * daemon started sucessfully*
win xp
htc sensation
the new eclipse adt sdk bundle from google so i suppose up to date.
I found there was a process call "Tadb.exe" in Windows Task Manager.
I guess Tadb.exe is a similiar adb application of Tencent. Because I got an alert of "android device detected by QQ" after I install the last version of Tencent QQ2013 Beta5 (6970) yesterday.
After I killed the Tadb.exe, the original adb.exe of Android SDK works again.
You can see the detailed proecss to solve this problem here:
adb cannot run, adb server is out of date
I turned off the Windows Firewall and its working like magic. I am connected to the Internet through WiFi. If you are not behind a proxy and are still unable to access the Internet through a wireless link via the emulator, go to Device Manager and disable your LAN card.
As I have tried as follow by combining omni.present's method , and finally emulator works fine.
firstly I stop adb.exe process in the task manager
then I stop and start eclipse
The fundamental reason is because the 5037 port on your machine to be occupied by a process, not only Android devices can not use adb connection ios device not use iTunes.
Can query process and close it, netstat / a / o maybe can help you to take up to 5037 ports.
To windows7 the LogsAndAlerts service will occupy port 5037.

Categories

Resources