Cause of android adb "usb device not found" problems? - android

I've found a variety of questions here talking about solutions to the "usb device not found" problem when using adb, but I haven't found any explanations about what's going on or if there's a long term fix.
When I'm developing I'll write some code then hit run or debug, watch the results on my device then repeat the process.
Every now and then, perhaps once every few days, I'll get the "usb device not found" error.
The first thing I try is to open up the task list and kill adb.exe. That sometimes works.
If that doesn't work the next thing I try is to kill adb.exe then disconnect the android device, reboot it, then reconnect it and then run "adb usb" from the command line. That almost always works.
If the above doesn't work then I'll reboot the android device and also reboot the computer. That seems to do it for all the remaining times that the problem occurs.
Does anyone know why this happens and if there's a way to prevent it from happening? My only theory (based on not much) is that perhaps the device gets hot (due to heavy cpu usage during development and debugging) and does something wrong which messes with the way adb does things.

I had the same problem. I ended up having to go to my computer/properties/advanced system settings/environment variables/ , click "PATH" , then paste ";c:\Android\tools;c:\Android\platform-tools" as the "variable value"
then i went into device manager - my computer/properties/device manager and seeing that the droid had an "!" by it. I then downloaded and unzipped android ADB into a file on the desktop. and then back in device manager installed the driver by right clicking droid/then clicking update driver software , and selecting the file on the desktop and it, voila.
it took 20 seconds.

Related

Android Studio Freezes randomly while device is connected

I have a new installation of Android Studio, 1.3.2. I'm new to android programming so I haven't had this installed here before, but I did have the android SDK installed a long time ago so I could root my phone via adb. Still, presumably when I installed studio and downloaded the new sdk it should've overwritten any older files I had.
My problem is that about 30 to 40 percent of the time when I'm testing my app, the entire IDE just freezes. I hit the little Play icon on the header, it loads to my phone, the phone gets the app, I can test it. Most of the time it works, sometimes I lose all ability to interact with studio. The app on the phone works fine, but nothing brings studio back. Importantly, this is NOT a Windows style "not responding" bug. I can maximize and minimize the window and drag it around without it going grey, and task manager doesn't give me the "not responding error".
It stays like this until I unplug my phone, at which point it immediately executes all of the button presses that were queued up while I was trying to click places. This makes debugging rather difficult, as I can't actually see logcat and follow along.
I do get the following errors in the ADB Logs tab whenever I plug in either of my two phones
PropertyFetcher: AdbCommandRejectedException getting properties for device 44f76320: device offline
PropertyFetcher: AdbCommandRejectedException getting properties for device 44f76320: device unauthorized.
This adbd's $ADB_VENDOR_KEYS is not set; try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
PropertyFetcher: AdbCommandRejectedException getting properties for device 44f76320: device unauthorized.
This adbd's $ADB_VENDOR_KEYS is not set; try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
DeviceMonitor: ExecutionException getting info for device 44f76320
I've revoked the USB Debugging Authorizations on both phones and confirmed via the popup dialog that I want to trust this computer, but I don't know if these errors are involved in this problem or not.
One last thing that may or may not be related: sometimes even when it doesn't entirely freeze, logcat is ridiculously unresponsive. I'll crash my program on a null pointer, and it'll take upwards of 30 seconds for the stack trace to show up (this is not, by the way, a very large program if that matters). Sometimes it never shows up at all, even though things are connected and seem to be working, I just get nothing at all in logcat.
Thoughts? Even just ideas on what to try next would be most appreciated, I'm stuck and most of my googling seems to be bringing up very different issues than the ones I'm having.
Just in case anyone else runs into this, I eventually solved it after upgrading from Windows 8.1 to Windows 10. I didn't do a fresh install, I just ran the upgrade process. When I first launched Android Studio, it had to update a few things, and one of the things it updated was the Google USB Driver. I'm willing to wager that was my problem all along, and the OS upgrade wasn't at all necessary.
So if you have this problem, try updating your USB Driver.

Android debugger continually disconnects

I have never had an issue debugging in Android until I switched to my current workspace. It happens in both Eclipse and IntelliJ. Previously I had an issue where the phone would hang at the "Waiting to attach debugger" dialog. Somehow I fixed that so the debugger at least attaches to my app.
Now I can set a breakpoint and have the debugger stop at that point. After about 5-10 seconds it disconnects no matter what I do. I'm able to read a few values of variables in memory before everything disappears. My co-worker is able to debug the same app just fine using Eclipse and we haven't been able to figure out what is wrong or different between our workstations (besides me using IntelliJ). We might have different images for our laptops though.
Any ideas? I've had to use Log statements for now but they are just too slow compared to using an actual debugger. I've tried using different USB cables and that didn't make much of a difference. I've gone through the debugger settings and nothing seemed out of the ordinary. Other Q/A's on SO have mentioned the app silently crashing, but I'm ruling that out due to it debugging fine for my co-worker.
I've been having the same problem running IntelliJ IDEA build IC-133.193. I solved the problem with the following actions:
Quit IntelliJ
From a command line kill the adb server with adb kill-server
From a command start the adb server as superuser with sudo adb start-server
Restart IntelliJ
IntelliJ will start the adb server if it detects that it is not running. The key appears to be starting adb as superuser before starting IntelliJ.
[Update] This doesn't always work. The best solution I've found is to start the app on the device and then attach the debugger to the Android process through the Run menu. I haven't had any disconnections using this method.
I have been fighting for a few days with adb not seeing my device. After trying many other posted solutions, I discovered that the issue was with Chrome also trying to connect its debugger to a web view. If Chrome is connected using chrome://inspect, then adb seems to disconnect. Quitting Chrome resolves the issue. Then I can connect with Android Studio and then restart Chrome and reconnect. Hope this helps someone else.
This fixed it for me
Go to Power Options on your computer
Click 'Change plan setting' on your chosen plan.
Click 'Change advanced power setting' on your chosen plan.
Expand 'USB Settings' .
Expand 'USB selective suspend setting' and change it to disabled.
This issue occurs to me when I try to use a USB 3.0 port. Using a USB 2.0 it does not happen.
This happens to me when the cable connection is sensitive.

emulator doesn't show in device view in ddms

When I try to debug using one of the configurations that I've set up (for example Android233), the emulator never actually launches. I just see a little green icon in my task bar that says "launching Android233," but it never launches. I've let it sit there for hours and it never does anything. I don't know if this is related, but my emulators don't show in device view in the DDMS perspective. I have a physical Android device, which shows up in device view. My question is, what is happenin' and how can I fix it?
Thanks for taking the time to read my question :)
I thought I had the problem figured out, but it stopped working again. Here's more information: When I run my debug configuration, in the lower right corner of my Ecplipse windows it says:
"Launching MyDebugConfig (100%)" and then there's a green icon next to it.
I looked in task manager and the emulator is not in there. I looked in DDMS and my AVD is not listed and there is nothing in the LogCat or Thread or anything else for that matter. I have my debug configuration set to prompt me to pick a device, but it never does that. It just loads my AVD, even if I have my phone connected (which is visible in DDMS). I'm so stumped. I've had this problem since I started using Eclipse and I don't know what to do.
Thanks.
Go to DDMS Perspective =>Click View menu=>reset adb
If Your genymotion virtual device is not seen in android device monitor then just try this.
1. start android studio
2. start Android Device Monitor
3. Lastly start the genymotion virtual device it will appear
The emulator won't show up in the DDMS section until its running.
The emulator won't lunch probably because you misconfigured it, currently the lunch dialog of the emulator doesn't support error messages, however you can get the lunch stack trace while you try to lunch the emulator via Eclipse.
Disconnect your physical device, run your project and select the emulator. you should see an error message on DDMS console.
If you in Windows try run (after starting emulator)
adb.exe kill-server
adb.exe start-server
and wait for restarting your adb

App won't launch on the device

No matter what app I try, it won't launch on the device. It works perfectly on emulator, but when I try to launch it on the device, it'll get uploaded & installed and then "Starting activity on device " appears and nothing happens - it just sits there and does nothing. When I repeat the process, eventually it will launch (but it has to be repeated like 5-10 times), but all those activity launching processes seem to remain active, which causes my phone to lag. I tried resetting adb, reinstalling Google USB drivers, nothing helps. I have a rooted phone, and custom ROM (it's called Darky's ROM 10.2) - could that be a problem maybe?
Sometimes it takes a long time to install and run, and ADB times out. Go to preferences in Eclipse, then to Android -> DDMS -> ADB connection time out (ms), and set it to something like 30000
You can try many things:
Compile and run a sample app on handset, does it run or not? If it doesnt then there may be a compilation environment (your PC) issue, signing or something else.
Download a free app from marketplace and see if you can run it.
Is this a standard Android phone or a rooted one? if its rooted then try on a standard handet.
Before installing do "adb kill-server" and then "adb start-server" to restart the adb. This may not be useful, but, just in case.
After installing the app, can you see it in Settings -> Applications -> Manage Applications menu?
Try a hard power cycle, by removing the data cable/charger and removing the battery for 10 seconds.
Also ensure that the emulator had the same screen dimensions as the handset you are testing on.
Attach Logcat and see what shows up there.
These tests will give you better idea of what is happening.

Android Device Vanishing

I have a really serious problem which is preventing me from doing Android development at work, which I have a strong imperative to get fixed as quickly as possible.
So, I plug in my phone to my OS X machine. I go to the terminal and I do this:
rutski#imac:~$ adb devices
List of devices attached
3331833A243A00EC device
Now, that looks good so far. But if I do some work for a few minutes I'll eventually get an error somewhere during "adb install", and when I run "adb devices" again I see that now the device is NO LONGER THERE!
So I unplug the phone, and plug it back in. I run "adb devices" and see the device back again, expect the cycle will repeat, and it will reliably disappear after a few minutes.
But it gets better. DDMS for me is completely unusable. I open up an OS X terminal and run "ddms" from the command line. A window pops open with a device list, and my device is there. However, if I so much as click on my device, it will vanish from the list, and I'll get this in the terminal window:
08:26:05 E/EventLog: device not found
com.android.ddmlib.AdbCommandRejectedException: device not found
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)
at com.android.ddmlib.AdbHelper.runLogService(AdbHelper.java:469)
at com.android.ddmlib.AdbHelper.runEventLogService(AdbHelper.java:445)
at com.android.ddmlib.Device.runEventLogService(Device.java:290)
at com.android.ddmuilib.log.event.EventLogPanel$8.run(EventLogPanel.java:454)
Yes, I've made sure that USB debugging is enabled. I've done a start-server kill-server with adb. I've rebooted both the phone and my machine several times. Nothing fixes the problem.
What the heck am I doing wrong here?
EDIT:
I just noticed that after rebooting my machine things are stable until I run an app that crashes via something like calling a method on a null object; that's when the device first vanishes from DDMS, and it is flakey forever after. Still, I'm confused about what to do here. I need to be able to debug crashes, and they will happen.

Categories

Resources