adb can't find device after failing to connect through WiFi - android

Essentially, my problem is that I tried connecting my device to adb over Wifi, got to adb connect xxx.xx.xx.xxx but then adb claims that it was unable to connect to xxx.xx.xx.xxx:5555.
Ok, but now I'm having trouble getting it back to listening over USB. adb usb tells me that there isn't a device attached and adb devices gives me an empty list.
I've tried killing the adb server and then restarting it, toggling the device's debugging mode and toggling the device's USB storage transfer but nothing seems to be working. This question seems very similar to my problem but I have no idea what the guy is doing in the solution.
I'm guessing the problem is that adb is still trying to listen through Wifi but since I can't connect to it over Wifi it can never go back to listening to it over USB. Idk...

For wifi, you may be able to get it to work if you first use the browser on the device to visit a webpage or something and so effectively wake up the wifi radio and its connection to the access point. You may need to keep doing this every once in a while.
(Maybe you should listen to internet radio while you work?)
Of course your access point will have to permit peer-to-peer traffic on the local subnet. In many cases that may be the norm, but I believe an access point can be configured not to support that, and some may default to such settings. There can also be issues between wired and wireless subnets sourced from the same box.
Finally, restarting the device might get it back into USB mode.

Related

Android 11 wifi adb error "Unable to start pairing client"

I downloaded the latest platform-tools for windows, then I enabled developer mode on my phone and turned on adb over wifi. However after I enter the command adb pair ipaddr:port I get the error "Failed: Unable to start pairing client" (after entering the code).
adb is working fine over the cable, and wifi adb is working with my watch. Any ideas?
I tried all possible way. Then I click on forget wifi and then again connect to wifi then entered the pair and code again then it starts working
Had the same problem. Turns out the port used for adb pairing changes each time you ask for a pairing code. I didn't update mine, so it didn't work. When I realized that, and typed in the pairing code, everything worked as expected.
In my case I was connected to a VPN on my workstation and that's why I got this message. Disconnecting from the VPN fixed it.
Try pinging the device 2-3 times and then pair. Only this solution worked for me.
For me, it worked after I restarted Android Studio (or the command line).
One solution that worked for me is to try and establish a tcp connection first to the pairing target.
nc -vz <ip_addr>:<pairing_port>
Once this is successful in establishing a connection, proceed with adb pair. I'm not sure why, but this is the only thing that worked for me. Rest all failed.
If you've recently enabled developer mode on your phone, try restarting it. I was receiving the error, "Failed: Unable to start pairing client", then I rebooted my phone and after that I was able to pair.
In my device the IP address given in Wireless debugging screen is 10.1.10.1 which I know is not my local router's IP address. My router uses 192.168.0.xxx addresses. I found my device's IP address by going to advanced section of connected WiFi network and used that when connecting to adb keeping the port same.
so instead of
adb pair 10.1.10.1:<port>
I used
adb pair 192.168.0.xxx:<port>
I was on a guest wifi network that blocked inter device communication. Switching to my main network solved it.
My issue was I had AFwall+ enabled, so some network connections where blocked which should not have been. I don't know which exactly, but disabling the firewall made it pair.
In my case "User Isolation" was enabled on my modem router which prohibited direct communication between connected devices, after I disable it everything worked as expected.
Both devices must be on same network. In my case I was connect to two different networks.
First make sure the computer isn't paired with the device already in Wireless debugging options under "Paired devices". If it is, forget the pairing. Next restart the device. Afterwards when the device boots back up again, re-enable "Wireless debugging". Sometimes (I think) the computer fingerprint expires on the device and adb pair starts failing. The device at this point may re-prompt you asking to allow the computer's fingerprint. After that adb pair should start working again. Finally once it pairs you may need to run adb connect again with the ip and port listed under "IP address & Port" in Wireless debugging options.
for me , I try all way ,close wifi or restart computer or restart phone, failed ,they all failed .
Until I shut down my VPN , it automatically connected, after that, I connect my phone after close the vpn, The connection has never failed

How to fix an adb offline device without connecting to usb

I've got an android device that was previously connecting over tcp, and later on when I tried to connect adb devices said it was offline. Is there a way I can fix this issue without connecting over usb?
I found that if I disconnect/reconnect from wifi, the error goes away! I did this by moving the phone out of range of the router, and back in.

How do you use ADB TCP/IP with USB debugging UNCHECKED?

I am trying to debug some USB attach/detach Intents while using USB Accessory mode to some custom Host hardware. I am able to connect ADB via WiFi TCP/IP and it works great. However, when a USB attach/detach Intent comes along, the ADB connection is broken - even though ADB is not running over USB at all.
After reading countless threads here that dance around that topic, a common suggestion seems to be that having "USB Debugging" checked in Settings will make the ADB connection sensitive to USB. Several posts suggest unchecking that box when running over WiFi/TCP. But I've tried that, and cannot associate ("adb connect 192.168.x.y") if that box is unchecked even when running over WiFi.
I have confirmed that when the box is unchecked, getprops still shows "service.adb.tcp.port 5555" like it always does. I've also tried explicitly killing and restarting the adbd daemon. Nothing works... except checking that box, at which point I can immediately connect via TCP.
So... what's the real story? I must say it FEELS likely that having that box checked would make ADB sensitive to USB even if it's not running on it. But is that box mislabeled, and instead of meaning "USB Debugging" it really means "Debugging regardless of connection type"? I really need to make ADB ignore the USB connection so I can debug attach/detach events. Any help appreciated. Thanks!

I need to debug my Android app while not plugged into my computer

So, let me start off by saying that I am 'relatively' familiar and comfortable with making Android apps and using both LogCat and DDMS to debug.
That being said, I'm encountering more of a logistical issue than anything else right now - I am making a locative app, where the GPS is fuelling and controlling other methods in my Activity, and after a while, it is crashing.
Now, because it is locative, I am walking around to test it, in order to receive different GPS locations. Because of this, I am not connected to my computer at the time that it crashes, so have no way (that I know of) to read the stack trace, etc.
In my particular instance, I am navigating through a series of activities, and finally reach the penultimate screen in my app, and while I am running the application in my studio, it runs indefinitely without issue. It is only when I take the device outside that it crashes...
I am wondering if anyone has any tips or tricks with this issue - I'm sure give the prevalence of locative apps, it must have come up, but I cant seem to find the right search terms. It could be as simple as saving the LogCat to file, and/or the stackTrace, but I'm not sure that's the answer...
Thanks in advance.
If I got you right, this is what you are looking for:
https://play.google.com/store/apps/details?id=org.jtb.alogcat&hl=de
Edit: Also there are many more apps like this. You can just browse around in Google Play Store
You can debug the app without rooting your android, unlike the other responses. start off by plugging the android into your computer, then run adb devices to make sure the device is there. Then, run tcpip 5555 to change the android to tcp mode, which will allow debugging over wifi. Disconnect the android from the computer, and connect to it by typing adb 192.168.x.xxx, replacing the x's with your android's IP address. It should connect with no issues, as long as port 5555 is open, and both the android and your computer is on the same wifi.
Simple: Wireless ADB
One of the reason that I choose to run CyanogenMod on my testing devices is that it is a stripped down version of Android that has some additional developer tools, one of those being the ability to access the wireless portion of the ADB system.
As you are probably unaware, you are able to establish an ADB connection to your device over WiFi, however, if running a stock ROM, this requires root access, as it can be potentially harmful to your device, as Wireless ADB will work even over your cellular network, meaning that you could potentially receive apps from other insert carrier here's devices.
If you wish to run WirelessADB, here is a Play Store app that will help you to enable the feature on your device. Requires ROOT
It is as simple as connecting your device to your local WiFi network, (same one the development computer is connected to), enable Wireless ADB, and then running the following command on your computer:
adb connect 192.168.1.101
Replacing 192.168.1.101 with the IP address of your android device.
By establishing this connection, you can run everything just as you would if the device was plugged in via USB Cable.
I recommend ACRA (Application Crash Reports for Android ). It allows you to send crash reports to a number of different destinations. See https://github.com/ACRA/acra/wiki/BasicSetup

Usb tether and debug at the same time

I need network connection on my Android device to test apps. My notebook WiFi adapter is broken, so after 2 hours I've set connection via USB. But! Eclipse doesn't see the device when I start "Wired Tether" on it to get connection and I can't debug my apps.
Does anybody know how to solve this issue? Use USB tethering to get internet connection on phone and debug apps at the same time?
I don't know of a way to simultaneously use USB debugging and tethering. Here are some workarounds, though:
Get a USB wireless adapter for your computer (see http://www.amazon.com/gp/bestsellers/electronics/13983791/ref=pd_zg_hrsr_e_2_4_last). I don't know if buying one of these is an option for you in India.
Send your apk to your phone wirelessly for app installation (see Developing on android-based device via wireless) and then view the logcat directly on the phone for debugging (aLogcat seems to be popular, and allows you to send log files via, for example, email, so that you can open them on your computer to view them on a bigger screen)
I know these solutions involve some cost, effort, or inconvenience, but hopefully one will work for you.
EDIT:
As noted in answers from #shkschneider and #CodeShane, Internet sharing via Bluetooth is possible. CodeShane's answer mentions PdaNet (which apparently also allows for simultaneous USB tethering and debugging), and includes a link. Another solution is OpenGarden. These solutions provide access to the Internet for the computer via the phone. If the reverse is desired (and this is not entirely clear from the question), reverse tethering seems to be the answer (see the answer from #NickL).
Long story short: you can't. Android simply does not supports it (that is more because of the USB standard and tethering action than AOSP's fault).
So to go around the problem, you should either:
Get internet form another source
Maybe you could have ethernet connection?
Tether internet from your phone to your netbook in another way
You can't use wireless tether since your wifi adapter is broken, but maybe you could tether using bluetooth?
Debug your phone in another way
Maybe you could use an android application like aLogCat or similar?
But in the hand, sorry, you can't tether usb from phone to netbook while usb debugging from the netbook. Your success will depend on your ability to find an alternative solution.
I would like to point out that I am using PDANet for USB-tethered internet to type this reply while I am also debugging an android application on the same phone via Eclipse Juno. Not sure which side fixed this, but it is awesome!
As for why Eclipse isn't seeing your device, standard troubleshooting tips apply .. make sure to enable USB debugging and unknown sources/3rd party apps, try restarting, check usb drivers, update drivers/eclipse..
Device not detected in Eclipse when connected with USB cable
http://developer.android.com/tools/device.html
Eclipse not finding phone
PdaNet 3.5
Eclipse Juno Service Release 1; Build id: 20120920-0800
You can use bluetooth tethering to get internet connection and debug using USB.
Step 1. Turn off USB tethering
Step 2. Turn on Wireless USB Debugging
Connect to your device via USB
Enter "adb tcpip 5555"
Unplug your device
Look up your device's IP in the system settings
Enter "adb connect [ip address]:5555"
Step 3. Turn on USB tethering
Now you can use internet via USB cable and debug app in wireless mode
That's it!
Yes, its possible. There's a hack available at below links !
Source: HowToGeek , StackOverFlow
You can actually connect the adb to the phone via TCP. You may need a rooted phone for this to work, though
If I understand your question correctly, you want to tether your phone to the PC via USB, and use the (internet)connection of your PC + still get logcat output?
Then yes, this certainly is possible.Tethering is when your PC uses the internet of your phone, the other way around is called reverse tethering. Your device has to be rooted, then you can use this application for reverse tethering.
When you connect your phone to the computer via USB, you press 'connect' in the application. It then installs an app on your phone, which handles the reverse tethering connection. It works, I sometimes have to press 'check DNS' while it is connecting to make it working.. but it works! Also debugging via USB works the usual way.
First you need to debug your device using USB cable then type adb tcpip 5555 it will allow debugging via TCP/IP protocol.
After that turn on your USB tethering, now your computer get internet connection but lost the USB debugging.
Now you must know your phone IP address so you can debug via TCP/IP. You can use command arp -a in terminal and look at the gateway address.
The last is connect to your phone using adb connect yourphoneip:5555 for example adb connect 192.168.42.129:5555
Now you get debug and tether at the same time
You can use
WiFi Tethering - For Internet connection
Connect USB for adb.

Categories

Resources