Im trying to get debug info through logcat when developing for android. Logcat does not show any info but only an error
error: more than one device/emulator
When i run command
adb devices
i get
List of devices attached
R3CT20DP74P device
emulator-5562 offline
I guess the emulator is preventing my phone from connecting with adb? Im also guessing thats what causing catlog from logging from my phone. Do i remove the emulator -5562 somehow? Ive tried adb kill-server but the emulator reapears.
Ive also tried
adb -s emulator-5562 emu kill
returns:
error: could not connect to TCP port 5562: cannot connect to 127.0.0.1:5562: No connection could be made because the target machine actively refused it. (10061)
Ive tried:
adb.exe -s R3CT20DP74P forward tcp:7201 tcp:7201
which returns
7201
but does nothing else. Emulator is still there.
First of all, there are 2 separate errors that you're getting, and they actually have nothing to do with each other. You'll need to deal with both of them:
error: more than one device/emulator:
you need to run adb kill-server to clear the connected devices, and then restart ADB. It'll auto-connect any devices that are physically connected via USB, but it won't connect any emulators or devices that are connected via wireless debugging
error: could not connect to TCP port: it looks like you're trying to connect via wireless debugging, and it's a bit finicky. It times out after a while, and the device starts rejecting your connection requests. To fix it, you have to physically connect your device to the PC using a USB cable, and as soon as you do that, it should give you a confirmation prompt on the device to allow the USB debugging connection. After you approve that request, you'll need to turn off wireless debugging, and then turn it right back on. It'll generate a new TCP port for you to use, and you will now be able to connect to wireless debugging using that new port
I'm new to android studio and have just made a new app, which uses position sensors.
All is well when the device is usb connected to the debugger. When I unplug the cable, the app runs fine and I can wave the device around, going to a different room etc. .
But when the app is restarted without that cable, it is "waiting for debugger", which is a little annoying at that point.
I have seen this https://developer.android.com/studio/run#changing-variant but that way I need to sign the app, and I fail on that.
Is there a way to run the app without signing it, and without that debugger cable?
To be more precise in view of the two answers that suggested wi-fi connections (which I can't verify at the moment because the box running AS doesn't have wf-fi connection).
I want to test the app even without debugging, and test it by changing location, too. So I would have to set up a wi-fi connection that would connect to AS over really long distances.
Instead I just want to tell the app (or the device): forget about the debugger.
This: https://stackoverflow.com/a/56541740/4142984 solved my problem.
For the first time you must need to connect device to the android adb and after that you can remove it and still get connection to the android adb.
you should install Android Wifi ADB
you need to connect first time your device with cable in usb debug mode and by using this plugin you can connect your device on the wifi after that you can remove the cable from the system and you will get connected your device to the Android Studio
Note : make sure your system and mobile device must be connected with the same wifi network.
1.Download android-sdk-platform-tools
2. Add the path to environment variables
3. Connect your phone to usb cable
4. Connect your phone and computer in same network(WiFi)\
Now in cmd
5.adb tcpip 5555
6. adb connect *your_phone_ip*:5555
Now you can unplug the usb cable.
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
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.
I have read all the relative threads about ADB not recognizing devices. My case though is different: ADB sometimes "sees" my phone (Samsung Galaxy) and other times NOT. No matter how many times I kill and restart the ADB service or I disconnect and reconnect the device from/to the PC. Quite an unstable situation here. You know, it's one of these things that drives you crazy. That's why I resorted to your help.
Has anyone had this exact problem and resolved it once for all?
More info:
The PC has never a problem recognizing the device.
I try with both the standard SDK adb.exe and the Universal ADB driver adb.exe.
Either of the above have no problem recognizing the emulator.
Couple things.
1) it's a dumb suggestion but sometimes its as simple as this. Did you try more than one cable?
2) If yes, then try this. try as many times as you have to get it connected since u said "ALWAYS" so it does work sometimes. When it does work, open terminal or command line and run the following commands.
(make sure device is connected when you do this AND you are on the same wifi network)
adb tcpip 5555
then disconnect your phone and run the following command:
adb connect YOUR_LOCAL_IP
do this many times, this is wireless adb connection and if this works, its something with ADB or your computer and not the phone.
Let me know if it works. I might have more ideas depending on what result you get
============ EDIT ============
I believe it's offline because it says 8080. I just did the same with my phone and I get the following:
Try this: disconnect phone physically (if connected) and all other devices and make sure by doing: adb disconnect.
then, do adb kill-server
then, on your phone, go to Developer Options and uncheck USB debugging.
then, right underneath that options, there is Revoke USB debugging authorizations options. select and revoke all devices
then, check USB debugging
then, back on your computer, run adb start-server
then, try reconnecting with the steps I said before. make sure port is 5555
when you run the adb connect command, make sure to add the port at the end.
example: adb connect 10.0.0.15:5555
Hope this works.