Why does Android Debug Bridge (adb) have to be restarted frequently? - android

This is what happens about half a dozen times every day:
An Android emulator (e.g. CPU/API: Intel Atom (x86), Target: API level 15) works fine for a little while, then Eclipse shows the following error when an app is installed
[2013-07-01 15:15:47 - Myapp] Failed to install myapp.apk on device 'emulator-5554': Connection refused: connect
[2013-07-01 15:15:47 - Myapp] java.net.ConnectException: Connection refused: connect
[2013-07-01 15:15:47 - Myapp] Launch canceled!
Sometimes closing and restarting the emulator will remedy this. However, most of the times, starting an emulator generates the following:
[2013-07-01 15:16:43 - Emulator] HAX is working and emulator runs in fast virt mode
[2013-07-01 15:16:43 - Emulator] emulator: warning: opening audio input failed
When this happens, the emulator will show up, but it will not work (i.e. apps cannot be installed). Resetting adb (DDMS > Device > Reset adb) will not work. I have to go to Windows Task Manager to kill adb.exe. Adb.exe will be restarted automatically in less than 20 seconds, and everything will be fine.
I am a bit sick of doing this many times every day, so I am seeking a way to avoid adb corruption.
Computer OS: Windows 8 Pro
CPU: Intel i5
Eclipse: Build id: 20121004-1855
Added on 2013-07-26:
I selected IronBlossom's response as the answer even though it does not answer this question specifically, but it solved the problem of having to restart ADB frequently. Actually, it solved multiple problems including a very significant one - unable to run Intel's Android emulators in fast mode and Windows Emulators simultaneously. There is a trick to run Genymotion emulators and Windows Phone emulators side by side.

Try using Genymotion . It runs on Oracle VM .
It even has GPS and Battery level features, comes pre-rooted with Superuser app.

I usually work with 2 computers, one is a High end computer playing windows 8 which I never got adb crashing or emulator running slow, but on my macmini with an i5 2415m and 2GB ram it crash a lot, but after I upgraded it to 5GB ram adb rarely get crashed, I can run 2 eclipses and 4 emulators and it rarely crashs.
So what I mean, is that maybe adb is not finished and it has some issues which may be related to memory leaks or thread synchronization, But (again but) it is just a shot on my experience, actually it never bothered me much.

When you hit a runtime error on device, instead of ctrl+c'ing out of adb, first click the prompt on the device acknowledging the crash has occurred. After that then ctrl+c out of adb. If it worked this should print out something happy.
adb devices

Related

Android studio: Cant get App to install on emulator

So up until today everything was working and after doing some trouble shooting on why my app's code was no longer updating, I uninstalled it from the emulator. Now when I go to run it again, it no longer launches or even displays as existing in my emulator. How do I get it to install on the emulator (again) so that I can continue to develop it further? Thanks guys
The Run Logs: Worked before, nothing unusally here.
C:\Users\Will\AppData\Local\Android\Sdk\tools\emulator.exe -avd x86-L
Hax is enabled
Hax ram_size 0x20000000
HAX is working and emulator runs in fast virt mode.
audio: Failed to create voice `goldfish_audio_in'
qemu-system-i386.exe: warning: opening audio input failed
console on port 5554, ADB on port 5555
Strange thing is that when I read through the Android Monitor it appears to be building the app each time I launch it. but it wont launch/display/install it. not sure how to put it into words sadly.
Any and all suggestions on this matter are welcome. Id love to be able to try different ways to make this work.
It seems that your avd memory is greater than your haxm memory. Set avd memory equal or less than haxm memory. For example if haxm memory is 512mb. Set avd memory equal or less than 512mb.
Using the K3b's way of using ADB an a apk file to manually install the app worked. Missing some core functionality by doing this way since some features dont work now but its a start at least.
adb install {file.apk}

it seems too many emulator instances are running on this machine. Aborting

When I run it from the SDK manager, the loading process works, but once it is done, a flash of the emulator appears then quickly disappears.
Sometimes after it loads, nothing happens.
At the worst when it loads, I get the "too many emulator instances are running on this machine. Aborting" message.
I want to start making apps, but this seems to be the only thing stopping me!
I had already turned off Windows Firewall.
pl'z, give me solution
Eclipse Indigo; r12, Windows 7 (64)
The Android emulator uses loopback ports (5554, 5556, etc) to communicate with the external ADB. If it can't do so, it assumes that other emulator instances are occupying these ports.
Failure to do so can be because:
A) Your ports are occupied? Try netstat -an | grep 5554
B) Your loopback interface is not configured - You said you're on Windows - Make sure Windows Loopback is configured (try pinging yourself). (On Linux the same would be achieved by "ifconfig lo", and see. It should be configured, with the right IP (127.0.0.1) and up.
Incidentally, it's MUCH easier to use Android SDK on Linux, because that way both target and host are Linux. Consider running the whole thing in a VM image - and your SDK Experience will be immeasurably easier. From experience.
I also had an error problem ERROR | It seems too many emulator instances are running on this machine. Aborting. in the emulator windows command.
I had a lot of virtual networks, all of which were active, because of the VirtualBox and vmware installation.
Solution: Disabling all those networks solved my problem.
For me, the reason is that I was using wsl-based docker on Windows.
Try disabling the option Use the WSL based engine in the docker settings (which resorts to using Hyper-V)
Enable Hyper-V in Windows Features.
Restart your computer and you should see it work like a charm.
My virtualbox VM, android emulator and docker now works together!
I have Hyper-V enabled (Intel CPU) for use with Docker and WSL2, on Windows 10 21H1.
Returning to Android programming after a hiatus, I reinstalled Android Studio today (4.2). It tried and failed to install HAXM (which is not surprising as it won't work with Hyper-V). I then was unable to open Android virtual devices.
After hunting around for answers (mostly people saying to disable Hyper-V which I was not ready to give up on), I found the exact process command line for the emulator and ran it in an admin window for good measure. Enter the "it seems too many emulator instances are running on this machine" error, previously invisible, which led me here. I checked ports and shouted into the void - nothing helped.
Then I rebooted, on the off chance something in all those attempts was somehow still holding resources (despite killing every related process).
The Android virtual device worked after that reboot, with Hyper-V still active. I hadn't changed anything that should have required a reboot, but evidently some resource(s) were locked along the way in my previous session.
(Also note that if you don't touch/edit \qemu.conf on whatever drive you run from (typically C:) you will see the incorrect Your emulator is out of date error if running from the command line.)
Just enable Hyper-V from Windows features

Android App "failed to install" on Samsung Galaxy Tab 10.1

I've been testing my app on a tab emulator (runs just fine), but when attempting to run the app on a Samsung Galaxy Tab 10.1 today, I am running into a "failed to install" error. When I run, I am given the option for the device, I select it and then receive:
[2014-02-19 09:46:51 - Ops_Suite_Android] Failed to install Ops_Suite_Android.apk on device '4300f4b4b0979017': timeout
[2014-02-19 09:46:51 - Ops_Suite_Android] Launch canceled!
I increased the connection timeout to 10 seconds and still no luck. Immediately proceeding the timeout, on secondary run i am given :
[2014-02-19 09:46:57 - Ops_Suite_Android] Failed to install Ops_Suite_Android.apk on device '4300f4b4b0979017': EOF
[2014-02-19 09:46:57 - Ops_Suite_Android] java.io.IOException: EOF
[2014-02-19 09:46:57 - Ops_Suite_Android] Launch canceled!
After this attempt, the device shows offline for any further attempts. I pull out the USB and reconnect, only to go through the same errors every time. Any ideas?
By the way, I am noticing that the connection itself seems to go out after the second attempt and sometimes will reconnect, bringing up the device options all over again on my comp (like opening folders or opening pictures). I also notice that plugging in results in no charge to the tab, i get the charge symbol on the device with a big red x through it. Could this problem be related to connection issues or driver issues or something else?
This issue is generally caused when the device loses communication during an install. Try the following.
Clean your project. (Delete /bin/ and rebuild all.
Different USB Cable
Restart device.
Restart IDE and ADB Daemon (Reboot)
If the issue persists, try deleting your creently installed ADB driver, and use the one provided in the Android sdk-addons pack.
I had the same problem with a Samsung S4. Tried everything suggested. plus more.. I ended up rebooting my osx machine and it started working again.

Device debugging Defy Eclipse Windows 7 64 bit

I am successfully using Eclipse with emulators. Now I want to use my Defy for device debugging, since the emulator is a bit slow.
My Defy has Cyanogenmod 7. My app is for 2.1 Android, so it should work. I followed all description and have device debugging set in my app manifest as well as the device settings.
If I type "adb devices", it now shows up one device. First I had problems with the driver with Win7 64Bit. After manual installation of the driver it worked.
I am wondering how to select the real device in Eclipse. In debug, I have my emulators. The real device does not show up in the list of my emulators. It is not an emulator so it makes sense. But how can a Start debugging on it. Or shall I copy the apk on the device and somehow attach Eclipse to the running process for debugging?
Best Regards,
Patrick
I do not get my Defy debugging in Eclipse. Some days ago it had worked. I just restarted my laptop and found the below error. adb is installed under the requested path. If I type adb devices in cmd in that path I get a device: efefeSOME_NUMBERrggr offline, Do not know if the offine is a problem
I also tries the wifi adb apps. If i connect with this tools I also get a device 192.168...:5555 device. This looks good.
After trying again eclipse debug, it directly starts the debugger. I have switched on enable debug, my phone is rootet. Can anyone give me a hint, what I may also consider? It had worked one day and now it does not.
[2012-04-12 22:10:01 - MyApp] ------------------------------ [2012-04-12 22:10:01 - MyApp] Android Launch! [2012-04-12 22:10:01 - MyApp] The connection to adb is down, and a severe error has occured. [2012-04-12 22:10:01 - MyApp] You must restart adb and Eclipse. [2012-04-12 22:10:01 - MyApp] Please ensure that adb is correctly located at 'C:\Entwicklung\android-sdk\platform-tools\adb.exe' and can be executed.
I have been learning Android by developing under Windows 7, Eclipse and the emulator. I wanted to start using my old LG Adroid instead of the emulator, but a soon as I plugged it in and did all the stuff to get it working with ADB, Eclipse blew up with : Please ensure that adb is correctly located at 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' and can be executed.
If I unplug the phone, Eclipse will start up the emulator and work just fine. I found that if I first do a "adb shell" and then exit the shell, Eclipse is happy and works.
I need to do this on every reboot of Windows.
You have to download the USB Driver from Motorola here USB DRIVER
then USB debugging like "Waqas" says and i also use Unknow Sources. I Develop with a Motorola Defy 2.1 and it works fine :-D
...sorry i read you question to fast. Maybe try this go in Eclipse to Run->Run Configurations and set the Target to Manual. Then you should be able to chouse your device
You need to enable USB Debugging mode in your device's setting to allow eclipse (ADT) to use it for development.
Settings -> Applications -> Development -> USB debugging (should be
enables)

Problem Nexus 1 running apps on my phone from Eclipse

I have a Samsung Google Nexus S. Great phone.
I have been developing apps on it, not too much of a problem.
Since last week I can suddenly not run apps from Eclipse on the phone anymore. I get the following error:
[2011-04-11 20:12:48 - ImageBrowser] Android Launch!
[2011-04-11 20:12:48 - ImageBrowser] adb is running normally.
[2011-04-11 20:12:48 - ImageBrowser] Performing com.xxx.android.imagebrowser.ImageBrowser activity launch
[2011-04-11 20:12:48 - ImageBrowser] Automatic Target Mode: using device '34315B519D6000EC'
[2011-04-11 20:12:48 - ImageBrowser] Uploading ImageBrowser.apk onto device '34315B519D6000EC'
[2011-04-11 20:12:48 - ImageBrowser] Failed to install ImageBrowser.apk on device '34315B519D6000EC': An established connection was aborted by the software in your host machine
[2011-04-11 20:12:48 - ImageBrowser] java.io.IOException: An established connection was aborted by the software in your host machine
[2011-04-11 20:12:48 - ImageBrowser] Launch canceled!
I am going out of my mind. Everything has been working perfectly before. I have tried just running a Hello world app with the same problem.
My Machine: Apple i5, pretty standard.
OS: Windows 7 32 bit
Eclipse: Helios Service Release 2
ADB: Android debug birdge version 1.0.26
I have re-installed the google usb drivers as per this following link: http://developer.android.com/sdk/win-usb.html
USB debugging enabled on phone
I have hard factory reset my phone in case something is wrong.
I am at wits end. Everything worked just fine, and then it all suddenly went berserk and now nothing works.
2 things: about a week ago I plugged in an ipod which had been in someones windows machine and it appeared to have a virus on it. I have run AVG and removed one or 2 things that were on there, but has not helped.
Secondly I have a 3g dongle I use for internet, and that connects via usb. But I have been using this together with the phone no problem...
When I plug in the phone, it immediately appears in Eclipse in the devices panel, and it is online and showing Honeycomb android version. Then, when I hit run, the above message/error occurs and then immediately the device is offline. I can only unplug and plug in again, and start from the beginning with same results.
Very oddly, I have had issues when disabling USB debugging, and trying to copy photos from my phone. When I enabled the device as USB storage, it woudl connect fine, but not always stay on as stable. If I then went to the images folder, it would disconnect. Extremely odd.
Help???
As you can see from the your log, the issue is An established connection was aborted by the software in your host machine.
So it wasn't caused by 1) a physical loss of connection or 2) the device itself.
The issue therefore lies with your computer. Have you tried:
Performing a full system scan with at least one different anti-virus package
Disabling the active-scanning of your anti-virus software while copying
Re-installing ADB
As a last resort: re-installing Eclipse and the Android SDK/AVD

Categories

Resources