A few days ago I started having troubles while trying to install a .apk on my Galaxy S2. I select my phone as the target, click OK and in the Console get the following error:
Failed to install AvatarRun.apk on device 'device number': timeout
Launch canceled!
Without changing anything in code and running again I can also get the error:
Failed to install AvatarRun.apk on device 'device number': device not
found com.android.ddmlib.InstallException: device not found Launch
canceled!
I have tried opening a command window and navigating to android-sdk\platform-tools and running:
adb kill-server adb start-server
This did not fix the issue.
This seems to just be a coincidence, but after failing many times I changed the minimum SDK in the Manifest from 10 to 7 and the .apk loaded on the next try, but has worked intermitently since and generates the same errors.
Can anyone suggest a method for finding what is causing this error?
After trying the fixes mentioned above, I ended up installing and reinstalling the Galaxy drivers. This didn't help. What eventually worked (so far) was to switch which USB port the Galaxy is plugged into. Once I did this everything was functioning as it should.
It may sound ridiculous, I tried all the ways suggested in Android error: Failed to install *.apk on device *: timeout
None of them works for me except unplugging the current cable and change for a new one.
There are various solutions:
Try changing the ADB connection timeout. The default is 5000; you should change it to 10000ms or so.
Window -> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)
Try to unplug and re-plug the cable. It seems that sometimes Eclipse loses the connection with Device. Sometimes you just need to plug into other USB port.
You might need to kill the ADB process and restart it.
adb kill-server and then
adb start-server
For me, the solution is to uninstall the old apk from the phone.
This problem often shows up if the computer is not fast enough. So,if you go to task manager you will see the performance. If you are watching video or running other programs at the same time while you are running your android application close other programs; at least during installing the app on device or emulator. You might even need to close internet browser.
You might need to update your computer to make it faster if you can.
Hope this helps someone:)
Related
I read many posts to fix this problem. None worked for me.
Error:
Target device: lenovo-lenovo_a6000-89a70dc9
Installing APK: C:\Users\Nikhil\AndroidStudioProjects\ProfitKey\app\build\outputs\apk\app-debug.apk
Uploading file to: /data/local/tmp/helix.profitkey.hotelapp
java.io.IOException: An existing connection was forcibly closed by the remote host
I tried below
Kill and start adb
Invalidate and restart android studio
Removed adb process in the taskbar
Restarted the device and pc
Restarted studio, clean and rebuild
Taskbar have only one adb.exe
Updated the driver from device manager
Another device it is working. But previously both device worked fine for me.
Target device: motorola-xt1022-ZX1B33PRVP
Installing APK: C:\Users\Nikhil\AndroidStudioProjects\ProfitKey\app\build\outputs\apk\app-debug.apk
Uploading file to: /data/local/tmp/helix.profitkey.hotelapp
Installing helix.profitkey.hotelapp
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/helix.profitkey.hotelapp"
pkg: /data/local/tmp/helix.profitkey.hotelapp
Success
Edited:
I tried with two lenovo A6000. One is working and another is not working. Then, Moto is working and samsung galaxy is not working. Whenever I am killing and starting the adb. The task manager creating two adb first and after few seconds one was hiding. Was this a problem? But still some devices working fine.
adb starts automatically after killing by command or from the task manager if android studio is opened.
Now working for all the devices. Just I uninstalled the driver of mobile in PC and changed the port to connect with that device. I think some problem with the port in my PC. After long research it fixed by a small thing. It might be helpful to someone.
I also faced same problem,this was a just port problem,I was using computer front USB port ,just use computer back USB port and problem solved.
Restarting adb.exe worked for me. (For windows, Just Go to taskManager and kills the adb.exe process and re-deploy)
I also faced same problem, just change computer USB port and problem solved. or use genymotion emulator
I closed my virtual devices, opened windows task manager, and killed all adb.exe tasks -- there was one constant one and another that would appear then disappear. Aftwerwards, i started my virtual device and everything worked again.
Make sure that no other program is trying to take control of the ADB. You can check this by opening task manager, right clicking on any of the adb.exe, and opening the file location. Turns out that my HTC sync manager had it's own ADB and wanted to run it all the time. I uninstalled the program and haven't had issues since.
In my case, I had to change the USB debugging cable.
Until yesterday everything was working perfect until today that I connected my phone (just updated to Jelly Bean) and adb.exe stop working. If I execute adb.exe I can see the help but when I want to use any command it just run forever and no message is shown.
I tried with "kill-server" and "devices" and it runs forever, no message at all is displayed and I must terminate the process to close it.
I just connect the same phone to other PC that was fully functional and also adb.exe stop working. The strange thing is that adb.exe will not work any more even If I disconnect the phone and/or I connect my tablet. Adb.exe just got useless.
I was using the same phone yesterday (android 4.0), with my tablet (android 4.2) and adb.exe was working.
Adb.exe is not corrupted as I checked it MD5 and it is the same as in working pc (5787e5df1a68e7afea82d58e5f0d6549 *adb.exe).
I have Android Debug Bridge version 1.0.31 and Android SDK tools 22. I uninstalled android sdk tools and Installed again but when is near to finish it hangs because it launches adb.exe and again it will run forever.
Please any suggestion or help?
Try rebooting. Sometimes the USB drivers lock up. I work HEAVILY with ADB in my project at http://android-casual.googlecode.com and I find it to be one of three things when ADB locks up.. 1. USB drivers, or 2. adb_usb.ini needs an update, or 3. on new devices you have to "pair" them so that ADB can perform any action.
To pair, you can disconnect, reconnect and run "adb devies" to display the pairing on the device.
Not sure if you're still facing this issue, but for what it's worth I had the same kind of issue with adb.exe, and came across this post while trying to troubleshoot it. In my case, I wasn't using any physical Android devices, only the Emulator. Everything had been working fine and then suddenly adb.exe would no longer respond (couldn't get any output from any adb command - it just appeared to hang).
In the end, my issue turned out to be another application I had installed on my development machine. It was starting as a service, and was listening on the exact same port that the adb server runs on (5037), which appeared to be confusing it. Once I changed the application to use a different port, adb started working again and everything was fine.
Run command
where adb
I had such kind of situation.
In my case
where adb
gave output
C:\Windows\adb.exe
D:\AndroidSDK\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.exe
I tried to run adb from disk C, when Eclipse used second adb from AndroidSDK (from disk D).
I removed adb from strange path C:\Windows\adb.exe, and this solved this problem.
I got the same problem,my solution is going to cmd and paste adb.exe path,and then click enter button.For example
D:\Android\Android\platform-tools\adb.exe
I have been facing this problem for quite sometime now. Running 'adb devices' shows me an additional dummy device although its named as emulator-5554. FYI, I don't have any emulator running as well.
adb devices
List of devices attached:
xxxxxxx device (Actual device)
emulator-5554 device (Dummy thingy shown as device).
How do I clean up this mess?
Same problem for me but I don't see any Bluestacks service in my services list. after
adb devices shows emulators I didn't have, I usually just type the command
adb kill-server
and running the
adb devices
once more shows only the devices that are connected.
I had the same issue. I did this and now everything is ok
click Windows+R
type services.msc
stop BlueStacks Android Service
I have figured out the issue. I had installed Bluestacks for Mac for trying out Android apps on Mac. This was running an emulator with a different name.
Figured it out by taking a screenshot of the emulator and it showed the launch screen of Bluestacks. Uninstalled Bluestacks and all is well now.
the adb server is scanning for emulators on all even local ports from 5555 to 5555+128 (5683). If you have a custom service which use one of these ports... You are stuck with the "adb -d command" requirement
pls check in task manager whether emulator-arm.exe is running. If so, try stopping both adb.exe and emulator-arm.exe
I had the same problem and non of these answers helped. So I figured out that my system didn't shut down properly and that's the reason I have a dummy emulator-5554. The solution was to create a new emulator with a name then launch it? While it's launching kill the server using cmd until when the emulator powers on and you can see its name under Devices in DDMS. After this shut the emulator...emulator-5554 is gone, Now you can start Bluestacks and connect
I was facing the same issue, and that due to BlueStacks too. In case you have Windows and you don't want to remove it, then you can stop its service "BlueStacks Android Service."
To do that click Windows+R, type services.msc then stop "BlueStacks Android Service"
Reference:
http://forum.xda-developers.com/showthread.php?t=2612389
Eclipse emulator NOT BlueStacks:
In the case of the eclipse emulator running in the background and you don't know how to close it, just go to devices tab and choose the dropdown menu on the right, then Reset adb. OR, just reset the adb using adb console.
Just open task manager and end task bluestacks
I also meet the same problem.Here is my answer to solve this problem.
in Windows system.
1.in cmd terminal,usr cmd netstat -aon|findstr "5555"
2.use cmd tasklist|find "PID",the PID para should be a process number which is the result of the first step .
3.changed the Port No. to other ,which should not be "5555"
That's done.
After trying:
adb kill-server
stopping adb.exe in task manager
adb usb
and a few other stuff I can't even remember. . .
I restarted my computer and the dummy-device was gone!
LogCat shows this error,
[2011-05-05 08:57:54 - test] Failed to install test.apk on device 'emulator-5554': timeout
[2011-05-05 08:57:54 - test] Launch canceled!
How about changing adb connection timeout. it's default is 5000 ms.
Window -> Preferences -> Android -> DDMS -> ADB connection timeout to 10000 ms
c:
cd\
cd C:\android\platform-tools
adb kill-server
adb start-server
copy the above in a notepad and save it as "ADB_restart.bat". Run it when you get this error.
Will probably fix the error. This also fixes lot of connection problems with devices and emulators.
Also as suggested by HERO, Do increase
your Timeout.
I have noticed that a combination of either restarting eclipse, or the phone/emulator, or both has proven effective in rectifying adb disconnects in many cases... I've never had luck with restarting adb after a disconnect personally
Try closing eclipse and reopening. You might get some warning when it opens something along of the lines of a marker not found but generally everything is still ok.
I had this problem with ADB (Android Debug Bridge) using an ethernet connection. The USB to ethernet adapter was quite old, using a newer one with a MOSCHIP chipset solved the problem.
Dont worry too much about it ... just look at the active emulators when this repeats again... It mostly is the Emulator not being registered as something that is active. Close the already running emulator and then restart it. you must be just fine...
Rajesh
I can run and debug my Android app on my phone just fine, most of the time. Then, seemingly randomly, when I try to run or debug my app from Eclipse, the Console in Eclipse says:
[2010-10-12 09:36:48 - myapp] Android Launch!
[2010-10-12 09:36:48 - myapp] adb is running normally.
[2010-10-12 09:36:48 - myapp] Performing com.mycompany.myapp.MyActivity activity launch
[2010-10-12 09:36:48 - myapp] Automatic Target Mode: using device 'HT01TP800561'
[2010-10-12 09:36:48 - myapp] Uploading myapp.apk onto device 'HT01TP800561'
[2010-10-12 09:36:48 - myapp] Failed to upload myapp.apk on device 'HT01TP800561'
[2010-10-12 09:36:48 - myapp] java.io.IOException: Unable to open sync connection!
[2010-10-12 09:36:48 - myapp] Launch canceled!
Retry: doesn't help, same messages.
Restart Eclipse: doesn't help.
Restart adb (adb kill-server && adb start-server): no errors, doesn't help.
Reconnect the phone: sometimes helps.
Reboot the computer: kind of drastic, haven't tried this yet.
Using Ubuntu 10.4, Eclipse Galileo 3.5.2, Android SDK 7, ADT plugin 0.9.6, Nexus One, Android 2.2.1.
Any bright ideas?
I was having exactly the same problem, but I already had my phone connected to the computer's USB port. Sometimes disconnecting and reconnecting the cord worked but then it stopped working completely.
However, disabling USB debugging on the phone and then re-enabling it has worked so far. Hopefully it keeps working! These fixes really seem like silly hacks.. I'm not sure what the underlying problem is.
I was able to clear this only by cycling the USB Debugging option on the phone.
This may also be related to a "too many open files" issue. I manually tried to install the app when getting the "sync" error above and that's when I got the "too many open files" clue. one brute workaround, based on some old posts, seems to be to restart the phone, and one google engineer suggested doing it twice, the second time before it goes into sleep mode the first time (details on why in the post).
That was a few years ago, and maybe they've fixed it, or just did some things to get around it in the usual cases and the reinstall-as-part-of-development is not a case that it addresses.
Nexus One here, CyanogenMod 7 (Android 2.3.7)... disable and reenable:
Settings > Applications > Development > USB debugging
And everything works now on Eclipse and Mac OS X 10.7.3.
I have been having the same problem when I have the phone connected through my keyboard's USB hub. IT went away when I connected straight to the computer's USB port.
I have had the same problem and restarting ADB wouldn't work for me. Sometimes rebooting my phone worked but not always, I was unable to program for about a week because of this glitch and I think I finally found a workaround! :-D
First of all, kill every program running on your phone. Having some kind of taskmanager makes this a quick task, otherwise you'll have to manually kill them all one at a time.
If that doesn't fix it, you will need to go to your phone settings, then go to "Applications", then go to "Running services", and kill every service in there. I'm using a Droid Incredible and I have yet to have this not work for me. :-)
So, the short answer is, kill all apps, and all services.
Also, keep in mind, you will need to close, and re-open eclipse to see if this fix has worked for you. I hope this works for you, I know it did for me! :-D
When this happens on the Kindle Fire I just power it off and back on again.
I fixed it just by disabling and enabling the debugging configuration on my device (SonyEricsson Xperia)
This error occurs when somehow the Android Debug Bridge , which is the tool to send data from our computer to the connected device, disconnects. As we know, there are some layers to get connected like the adb itself and of course, the last layer is the USB cable, so when you already tried to restart your adb script and seem not working, you just need to reconnect your cable.
I see this problem regularly in both attached devices (Phone or Tablet) and even the emulators. I noticed that the problem often follows periods of inactivity (after a lunch break for example). It may be that the Operating System on the development machine is trying to conserve resources and adb just isn't all that JIT friendly.
On windows I have to close the IDE and open Task Manager and force stop (kill) adb, then relaunch Eclipse. This always works for me...
I noticed if I set a higher priority in task manager for adb, this problem is greatly reduced--although it can still happen.
Restarting the phone has also fixed this problem for me whenever reseting the usb cable didnt fix it
The solution is likely to run on your android phone (on local terminal or ssh terminal):
$ stop adbd; start adb
I don't like overkill solutions like rebooting hte phone... and this is usually not needed under Linux. I experienced the same problem when connecting over Wifi, so USB is maybe not responsible at all. Reading the answer from user655489, I got the idea to run lsof, and then lsof | grep adbd | wc -l => I think I had over many sockets open with all FD from 0 to 1023 in use... how suspicious.
I ran killall adbd, then restarted adbd per How can I connect to Android with ADB over TCP? And the problem was gone.
The cause is that, at least when debugging and having to kill my non-working apps, that several of the sockets never get closed.
What helps for me is the following:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If you are debugging on AndroidX86 (or otherwise have root access to your Android developer machine)
Kill the "adbd" process.. and let it restart.
e.g.
[On Android VM]
kill adbd (e.g. kill `ps a| grep adbd | awk ' { print $2 } ' `)
/sbin/adbd will restart automatically
[On DEV station]
[dev station] ./adb disconnect
[dev station] ./adb connect
If you don't have root, probably toggling USB debugging, rebooting, etc could also help.
As it also restarts adbd
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I have been experiencing this problem very often (I mean like every second time I launched Debug). I was using a rather long USB cable. I switched to the original HTC USB cable which is short and the problem was gone!
I experienced this problem when my USB cable was connected to PC via keyboard USB :O. When I connected it to PC directly my problem solved.
I hope this works.
Enjoy!
As per Maven Explanation I tried this solution. but I was getting the same problem. So I restarted the device. And it started working perfectly.
Try this,
Disabling USB debugging on the phone and then re-enabling under
Settings -> Applications -> Development -> USB debugging
its works fine.
This solution worked for me
Click Revoke USB debugging authorizations.
Click OK.
Reattach USB.
Click OK for Permissions.