Related
It seems that wireless ADB has more and more issues each time I update Android Studio. Using 2.1.1, I'm now unable to connect to my tablet using the command:
adb connect <ip addr>
It results in the error:
unable to connect to <ip addr>:5555: cannot connect to <ip addr>:5555: No connection could be made because the target machine actively refused it. (10061)
This happens directly after approving the connection in the dialog box on the tablet. Before today I was forced to do an adb kill-server prior to attempting to connect to the tablet but now that doesn't even help.
Generally you can say this error is network related, check these items first:
make sure your computer and your device can see each other in network mostly this means they are connected to the same router, but in more advanced scenarios your device may be connected to a wireless router and you computer may be connected to you Local Area Network. what is important is they can see each other. you can check this by pinging you device ip address from you computer.
make sure there is no conflict with ip addresses, this might be very simple. but if you do not use DHCP server and you enter the ip addresses in you devices you could mistakenly entered same ip address in different devices
when you are sure about the network issues redo the famous steps
So when you connected by USB follow these commands:
stay connect via USB
connect to your WIFI network (computer and mobile device both)
ping DeviceIP (must be have ping to your device)
adb kill-server
adb usb
adb tcpip 5555
unplug usb cable (as per #captain_majid 's comment)
adb connect yourDeviceIP
adb devices (must be see two device names , one of them is by deviceIP)
unplug USB cable
Steps from could not connect to tcp:5037: cannot connect to 127.0.0.1:5037: No connection could be made because the target machine actively refused it. (10061)
when restart device then your port also channge so hit command below
1- adb kill-server
2- connect your phone to pc with usb cable
3- adb tcpip 5555
4- adb connect (your device ip):5555
Device and PC are connected to same network connection.
1 stay connect via USB
2 adb kill-server
3 adb usb
4 adb tcpip 5555
5 adb connect 192.168.43.1:5555
6 adb devices (must be see two device names , one of them is by deviceIP)
7 unplug USB cable
I had the same issue. These steps worked for me:
connect your device with usb
when your cmd already in AppData\Local\Android\Sdk\platform-tools>,type adb tcpip 5555
the cmd will show restarting in TCP mode port: 5555
type adb connect 192.168.43.1:5555
Hope this can solve your issue.
I recently faced the same problem.
It occurs because your device and PC are connected to different Networks.
when restart device then your port also channge so hit command below
1- adb kill-server
2- adb tcpip 5555
3- adb connect (your device ip):5555
I got this error when I had Bluestacks emulator started together with my phone attached.
When I typed in command prompt adb devices I could see two devices:
adb devices
List of devices attached
dfdcdc9c device
emulator-5554 device
Before typing adb connect I had to type -s and device ID:
adb -s dfdcdc9c tcpip 5555
adb -s dfdcdc9c connect <ip addr>
In case of me, i tried different port 5557 than again 5555,
adb tcpip 5557
adb connect device_ip_address
gives same error(10061) than again tried with,
adb tcpip 5555
adb connect device_ip_address
result: connected
that works for me(while the other thing is ok like as developer option is on and connected to same wifi)
Make sure you have to connect your phone through a USB cable for the first time.
Using Command prompt, Go to your Android SDK Directory (sdk->Platform-tools) and then
run the following commands
1- adb kill-server
2- adb tcpip 5555
3- adb connect 192.168.1.130 (Replace IP Address with your phone IP)
4- Now you can unplug it.
5- Then go to the Android studio and choose the device with IP address in
Run
Dropdown. Hope this will help it for everyone.
And then for next times just runs following command
adb connect 192.168.1.130:5555
Note: If Device is not showing in Android studio devices dropdown then
connect **USB** and run following commands
1-adb kill-server
2-adb usb
3-adb tcpip 5555
4-adb connect 192.168.1.130:5555
You must connect the mobile device via USB first, then type adb tcpip 5555 ,
and then enter your device IP adb connect <your_device_ip>
I solved the problem by enabling USB Debugging in Developer Options.
Unfortunately this issue can be caused by different reasons.
One of the reasons - make sure previous communication is disconnected.
USE:
1. adb kill-server
2. Issue command adb disconnect after restarting adb server. Do same thing after finishing job
3. run adb remount
4. adb tcpip 50555 (I usually use higher port number)
5. unplug USB cable
6. adb connect device_ip:50555
when done run adb disconnect
Following steps are standard ones to follow( mostly same as previous answers):-
adb tcpip 5555.
adb connect your_device_ip_address.
adb devices (to
see if devices got connected).
But in some cases above steps gives error like "unable to connect to device. Make sure that your computer and your device are connected to the same WiFi network." And you notice the devices are already on the same network.
In this case, install this plugin "Wifi ADB Ultimate" and follow below steps.
Connect the device once through USB.
Refresh the list to check whether its connected.
Go to About Phone > Status > IP Address and note your IP
address(e.g. 198.162.0.105).
Come back to Android Studio and fill in this IP as done in below
photo and hit the run button.
I had same issue with Android Studio 3.5.2, here is how i solved it.
First you must connect your device via USB once. (Debugging mode starts only when usb is connected)
Go to command prompt :
adb tcpip 5555
(watch for port on which adb started)
then : adb connect :
After successful connection goto Studio>Run>Select Device.
I assume you already solved the problem by now. but here is the way to avoid the problem if you are using multiple devices. I used to have the same issue so many times until I understand, how it works.
I was also trying to connect multiple devices one after another or trying to connect the same device after a while.
Always make sure to disconnect the older device before you connect the new device:
adb disconnect
after that, you will be easily able to connect new device:
adb tcpip 5555
adb connect <your_device_ip>
you can always try to ping the device using the ping command, if the ping is not getting acknowledgment then you must have connected to different wifi then your laptop or you haven't connected to wifi at all:
ping <your_device_ip>
For anyone who is Android 11+
Enable Developer Options
Enable Wireless Debugging
Allow wireless debugging on this network.
Pair Device with Pairing code
Type in adb pair [Phone_IPAddress]:[PORT] [PAIRING CODE]
After Successfully Pairing. Type adb connect [Phone_IPAddress]:[PORT]
For more info: ADB Documentation
Usually the 'target machine actively refused it' message is displayed when the target machine's 'ADB debugging' feature is not turned ON. It is turned off by default in almost all devices unless we enable 'developer options'. So whenever you land on this error, make sure you go to the settings of your target machine and trickle to the developer/development area and somewhere there should be a place to enable ADB.
After weeks of struggle and trying different approaches while everything was right and on the same network (ping {ip} was coming back positive) I figured the dumb debug bridge does not look for all network adapters to find the device! The device got connected when I manually disabled all other network adapters except the one (WiFi adapter) which was required to connect.
Step 1. Type command in terminal adb tcpip 5555
Step 2. Type command in terminal adb connect <your_phone_ip>:5555
Now check in studio device Monitor tool your phone connected without wire.
Note :- Most important your Laptop & Mobile Device Connected with same Network
I had the same issue and I thought it might be because of the network and tried many solutions but didn't work. Lastly, I checked my IP address which was updated for my device and was the root cause for this.
So please check the IP address first and use adb tcpip <port> to start listening the connection and adb connect <IP>:<PORT>
Try this way change adb to .\adb
PS C:\users\mori\appdata\local\android\sdk\platform-tools> .\adb kill-server
PS C:\users\mori\appdata\local\android\sdk\platform-tools> .\adb usb
PS C:\users\mori\appdata\local\android\sdk\platform-tools> .\adb tcpip 5555
PS C:\users\mori\appdata\local\android\sdk\platform-tools> .\adb connect 192.168.1.34:5555
connected to 192.168.1.34:5555
I had a similar problem. I found out the problem was if I had other devices/emulators connected to the adb already, the "adb connect <ip_addr>" command would give me the "No connection could be made because the target machine actively refused it" message.
The solution is to make sure all the other devices/emulators are disconnected (either physically disconnect or quit the emulator application) before running adb connect <ip_addr>. You can then reconnect your other devices (if you need them reconnected). A total pain.
Your mileage to this solution may vary depending on your problem.
I got this error when trying to establish an ADB connection to a smartwatch with WearOS 1.0 (Huawei Watch 2) via WiFi. Enabling the menu entry for fixing some WLAN issue ("Fix error via WLAN" -- my own rough translation of the German caption "Fehler über WLAN beheben") in the "Developer options" on the WearOS device solved the issue for me.
I had the same issue. It was working perfectly for a month, and then one day it stopped working. I tried all the solutions above, but to no avail. Then, I noticed that for some reason, the IP address of my phone had changed, ending with the number 1 instead of 0. So I connected to the new address with 1 as the last digit in the address and now it works again. Weird.
In my case I played with my device long enough to somehow mess up adb deamon, so port number was not set up correctly anymore.
getprop service.adb.tcp.port returned empty string.
So I solved this with following commands:
stop adbd
setprop service.adb.tcp.port 5555
start adbd
I ran all commands on rooted device in app that emulates command prompt.
So I came here because I want to adb shell into my physical Android phone over the network. Lots of useful answers are provided, but the most obvious fact is never stated. Here is the #0 fact:
The Android phone should ALWAYS be connected via USB to the laptop
And then another different laptop will do adb connect ...
This was not what I had in mind and all the above answers never mentioned it.
Go to Android Studio File - Settings
Next..
Happy Codding :)
I had a problem with my Huawei. For some reason I had wrong drivers, on Device Manager it was showed like "Android Phone". Then, I updated the drivers from Device Manager, I choose another driver and now it is showed as "Huawei" device.
From there I connected my device whitout problem (adb connect IP:5555)
For Android TV, Connect PC and TV in the same network (wi-fi),
enable developer option, and go to developer option and enable ADB debugging option.Then run the commands given below
1. ping <ur IP> (check the connection)
2. adb disconnect (to remove all the previous connections)
3. adb connect <Ur IP>
4. adb install app_name.apk
I have attempted to use many solutions above to no avail and found some pretty simple solution that works for myself.
If you are using a real device to debug like me, you may check the device official website to download the android USB driver for your development environment.
I'm using Samsung phone to debug and using windows as development environment thus I went here, download the Android USB Drivers for Windows and run it.
It resolves my ADB problem.
Sorry for the nooby question, I am having trouble sorting this out using the web.
I am trying to simply connect my device to my pc via adb to debug my application.
My device is rooted. Adb debugging is enabled. I downloaded an adb running application and started ADB.
Now i am trying adb connect ip:5555. and keep on getting "unable to connect to ip:5555" ...
Same happend when i try to connect via usb.
c:\>adb connect 192.168.20.191:5555
unable to connect to 192.168.20.191:5555
Help...?
EDIT:
C:>adb devices
List of devices attached
06fecaa1 unauthorized
Launching Cordova
Open Node.js / CMD
Point to "the directory where you have located your source folder" >>> C:\Projects\RJX
Enable Wifi
Turn on Developer Option under settings
Enable / Check USB Debugging Option under settings (Google if cannot find this option)
Enable / Check the MTP Option under settings (Google if cannot find this option)
ADB Commands
adb kill-server
adb start-server
//plug off cable from mobile and plug in again if you connected your device earlier
//Uninstall the application from mobile if you already installed. (if necessary)
adb tcpip 5555
adb connect "ip" //adb connect 192.192.2.128
adb devices //to check device details
cordova run android --device
if this steps are not worked, try to close the cmd and do it again. Sometimes it needs some refresh.
**Android devices version 4.0.4 and after should be no problem if you follow these steps.
I will assume you are able to understand adb connect / ip's etc I won't bore you with that
but there are two lame "gotcha's"
THE GENYMOTION GOTCHA
genymotion WRECKS a lot of this sometimes.. I am sorry but it does.. it has a "I know what I am doing I am taking over" mentality.. sadly it doesn't know what it's doing :-P often you have to turn off genymotion for the adb->usb to work.. basically connect phone FIRST ... make sure it's there in eclipse (adb kill-server / start server if needs be ), then AND ONLY THEN then genymotion AFTER
THE OOPS [/facepalm] GOTCHA
check that your phone it isn't in Windows merely as a "Camera" - go to My Computer and look. If it looks like this pic it's that you're not running Samsung Kies(/disabled because it's annoying) the phone still goes "blub bling" when you plug it in, it may be connected via wifi so have a LAN ip but it is NOT really "connected" to ur PC. instead run/download/update this (with phone disconnected) then make sure Kies is happy AND MAKE SURE MTU is enabled
This error happened to me when PC was (accidentally) NOT in the same network as Android. When I logged on Android to the same WIFI network as PC it now works perfect and I don't have this problem.
The answer here is that it's not listening on the correct (default) port. So you need to set the TCP/IP port to 5555. Connect your device via USB and issue the following command in cmd (terminal):
adb tcpip 5555
Following this your adb connect should work fine, e.g.:
adb connect 192.168.0.n
Hope this fixes it for you.
This happened when I was previously connected with one device (e.g. apps2fire) and then tried using adb command from another machine. I rebooted the Android device and then tried again and received the prompt to allow the connection as I would have expected.
First, check your ip address in your device, then following this command.
adb kill-server
adb tcpip 5555
adb connect [your-ip-address]:5555
For some reasons, my phone does not work anymore with cable.
I saw on the Internet that it is possible to connect adb to the via Wifi, however I tried it and I get this:
adb devices
List of devices attached
192.168.1.2:5555 offline
I search this on Google and it seems that it is related to Android 4.2.2.
And indeed, my device is running Android 4.2.2.
I didn't find any answers on Google for my problem since it is always with a cable, mine is on Wifi...
Any idea how to solve this?
For me the complete steps that worked were :
Settings -> Developer options -> Revoke USB debugging authorizations (clear the list of authorized PCs).
Set USB Debugging OFF.
In Terminal write : adb kill-server
Then : adb start-server
Then : adb connect xx.xx.xx.xx:5555 (the devices ip), it should say unable to connect.
Now turn ON USB debugging again and type the adb connect xx.xx.xx.xx:5555 again.
It should now ask for authorization and you are back online without
needing to connect cable to USB, only wifi used.
run adb kill-server, then try to connect wirelessly again. It worked for me.
I could not find exact solution for this problem too.
Best way worked for me was disconnecting device from wifi, then try to connect while device is not connected to Wifi like:
adb connect 192.168.55.3:5555
this causes adb waiting for connection. immediately connect device to wifi and adb will detect device and connect again.
hope this helps.
Disconnect adb over wifi, connect your phone with a USB-cable to your pc. It will ask you on your phone is you want to allow the connection. Tick always allow. You will only get this when you connect with USB and have to do this only once, you can use over wifi afterwards.
Don't get the pop-up? Try the answers on google over a cable, since you need to do this first.
It seems you want authenticate adb over wifi.If you had your device rooted,you can try this way.
Copy ~/.android/adb_key.pub to your android device,and rename it to adb_keys
Move it to your /data/misc/adb/
Reboot your android,then reconnect over wifi.
For the first time in debug mode, you need to Authorize your phone with the PC, and that requires the USB cable. After that you can use Debug over WIFI.
If you want to force your phone to show the Authorization message box, simply delete the below file.
/data/misc/adb/adb_key
In android studio go to Preferences->Plugins
Download and install this plugin
ADB WIFI Connect
, restart Android Studio
Connect phone via USB
In android terminal use command: adb devicesyou should get visible device connected via USB:
List of devices attached
988a57334e57365058 device
Click on plugin icon in android studio AndroidWiFiADB
If phone get connected properly via WiFI, you see in event log:
12:41 Android WiFi ADB: Device 'ModelOfYourPhone' connected.
In android terminal use command: adb devices use should get
List of devices attached
988a57334e57365058 device
192.168.60.101:5555 device
Disconnect USB cable and re-check again adb devices, should remain only device connected via wifi:
List of devices attached
192.168.60.101:5555 device
Try disconnecting your device with:
abd disconnect <IP/TCP>:<port>
Then restart the WiFi connection of your device, and reconnect your device with:
abd connect <IP/TCP>:<port>
That may fix it; it worked for me.
For me, the important part turned out to be the following line adb tcpip 5555 together with using the port in the IP of my phone like so: adb connect 192.168.1.87:5555 (only using one of them, did not work, i.e: writing the second alone didn't work, writing the first and then excluding the port in the IP also didn't work). The adb tcpip 5555 line is not mentioned anywhere here. So, for me, the PORT needed to be both manually set and used in the connect line!
These are the events of my command line in Windows PowerShell Admin to demonstrate (Wifi on and debug mode on and confirmed permission when the popup came):
notice that the connection first failed, then it said it was connected which is weird behavior to begin with (no matter what, it always failed once and "succeeded" once), and in both instances, the device showed as offline. The disconnect commands also confirm that its 110% offline
PS C:\WINDOWS\system32> adb kill-server
PS C:\WINDOWS\system32> adb start-server
error: protocol fault (couldn't read status): Connection reset by peer
PS C:\WINDOWS\system32> adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
PS C:\WINDOWS\system32> adb connect 192.168.1.87:5555
failed to connect to 192.168.1.87:5555
PS C:\WINDOWS\system32> adb devices
List of devices attached
220947272e047ece device
192.168.1.87:5555 offline
PS C:\WINDOWS\system32> adb connect 192.168.1.87:5555
already connected to 192.168.1.87:5555
PS C:\WINDOWS\system32> adb devices
List of devices attached
220947272e047ece device
192.168.1.87:5555 offline
PS C:\WINDOWS\system32> adb disconnect 192.168.1.87:5555
error: no such device '192.168.1.87:5555'
PS C:\WINDOWS\system32> adb disconnect 192.168.1.87:5555
error: no such device '192.168.1.87:5555'
PS C:\WINDOWS\system32> adb tcpip 5555
restarting in TCP mode port: 5555
PS C:\WINDOWS\system32> adb disconnect 192.168.1.87:5555
error: no such device '192.168.1.87:5555'
PS C:\WINDOWS\system32> adb connect 192.168.1.87:5555
connected to 192.168.1.87:5555
PS C:\WINDOWS\system32> adb devices
List of devices attached
220947272e047ece device
192.168.1.87:5555 device
As soon as I added the adb tcpip 5555 command and it restarted in TCP mode port: 5555 the adb connect 192.168.1.87:5555 command worked!
Make sure that pc is authorized in the device by going to Developer options -> Revoke USB debugging authorisations and then trying to connect via USB. After accepting the PC, disconnect the cable and connect through wifi.
adb kill-server
adb run-server
adb connect IP:5555
Although in my case, when I tried to connect it failed at first and second try it said already connected.
I disconnected from the device and connected again and it solved.
adb disconnect ip:5555
adb connect ip:5555
I solve this problem for huawei P10.
its about phone's developer settings => find usb developer settings, and under usb developer setting there is a "adb debugging in charging mode..." enable it. My problem solved with this way. Hope yours too....
My solution steps:
Turn Off WiFi and Turn it back On again.
Settings -> Developer options -> Revoke USB debugging authorizations.
Settings -> Developer options -> Turn Off ADB over network and turn it back On again.
adb kill-server
adb start-server
adb connect xx.xx.xx.xx:5555
Note: Step 3 was the key for me. don't forget it.
In simple cases it will start after Enabling USB debugging
For complexities you need to delete the
adbkey
file from
C/.android and then running following commands in command prompt
adb kill-server
adb start-server
adb devices
Note that wireless adb connectivity in Android 6.0.0 is broken. Updating to 6.0.1 fixes the issue.
https://stackoverflow.com/a/34530543/1123355
In Windows, if you are using system-wide proxy software like Proxifier, you need to add adb.exe to the ingore list or direct-mode list. In my case, using Proxifier will make adb able to connect to any IP address even when the phone is not connected to the WiFi, and this leads to device offline.
I know its late to answer but I believe this is the exact answer:
go to WIFI setting on your device and "set a new IP" in your network IP range an reconnect.
Conflicting ADB connections can cause this issue as well:
Windows Host with Docker to Hyper-V Android x86 emulator
I didn't see this answer here yet so for those attempting something similar, the issue I had was that the local Windows Host ADB process had already acquired the adb connection during start up (adb server start).
By simply running: adb disconnect <Device/Android x86 Hyper-V ip>:5555
on host machine
Running adb connect <Device/Android x86 Hyper-V ip>:5555 on the Docker container was able to successfully acquire the remote device (aka Android x86 Hyper-V)
IMPORTANT!!! Until you disconnect Docker (or whatever), your host machine (or any others) will not be able to connect, apparently only one ADB connection at a time is allowed.
I didn't need to do anything else listed above. Hope this helps others.
Just turn off your Proxifier or something else like this.
Socks5 works fine
Watever! I'm always using these steps to connect ADB Wifi with android studio
STEP-1:
1. Go to Android studio->Settings-> Plugins -> Search ADB WIFI
2. Install the pluging and restart android studio
STEP-2:
1. Find the location of SDK Manager For ex for my computer
Copy the whole location
Now open Terminal in Android studio itself( This will show in right bottom corner).
type cd YOUR_SDK_LOCATION
type cd platform-tools
Now type adb tcpip 5555
FOR NEXT STEP YOU MUST CONNECT YOUR MOBILE AND LAPTOP WITH SAME WIFI
type adb connect 192.168.6.100:5555 in terminal (Here 192.168.6.100 is your mobile IP Address)
now the message will show like this 'connected to 192.
168.6.100:5555'
STEP -3 :
1.Go to Android studio->Tools->ADB WIFI-> ADB Restart
1.Go to Android studio->Tools->ADB WIFI-> ADB USB to WIFI
Like below
That's it .
In My case my wifi network is not same thats why i am not getting connected with the device.
There is very easy and helpful plugin for this purpose Android Wifi ADB
How to Connect using plugin:
connect device using cable
click on Android wifi adb icon
disconnect your USB connection now your device is connected over wifi.
Enjoy Happy debugging.
adb reconnect offline
adb connect [ip]:[port] (for exemple adb connect 192.168.8.100:44
While all tips with killing ADB server helped me many times, now I got the message:
cannot connect to <IP>:<port>: No connection could be made because the target machine actively refused it. (10061)
It was possible to attach the device only while it was connected with USB, and after disconnecting cable it appeared as offline at the attached devices list.
I have just solved my problem by changing the USB configuration:
Developer options > Select USB Configuration: MTP (Media Transfer Protocol)
PTP (Picture Transfer Protocol) works as well.
Screenshot
I hope it will help.
I have this problem just now. Note that my case is special, the usb has been disabled for security concerns. Reboot not working. This is not ip problem since ping is working and nmap shows 5555 port is open. Also since I will not able to connect if port is wrong, so nothing to do with port.
There are 4 reasons:
Because another pc in the local network already connected, so the other guy have to adb disconnect first, then I can do adb disconnect and adb connect <ip>, since only one person can connect at the same time.
A hotspot ssid name might consists of multiple bssids in (especially you're in office) local network, so you need to ensure your pc try all the hotspot bssids which match the android connected hotspot bssid. Note that I noticed it's not always the case (Now I tried different bssids still success), but it did solved before.
Ensure the port 5555 is open correctly. Even though there are many ways, but you can download this app to open port 5555.
And I just encounter a weird case, client A connect just fine. But then client B turn on wifi and attempt to connect but failed. Then this failure causes original client A no longer able to connect. Reboot device/adb disconnect/adb kill-server doesn't help, and confirmed the ip is same(tested by turn off/on device and observe the ping). I make a joke about client B wifi still turn on may interfere the device wifi. Then I realized Client B disconnect/kill-server is not enough, client B also need turn off wifi to make client A connect. And it did.
Try,
adb disconnect <your_ip_address>:port_number or adb disconnect
eg.
adb disconnect 192.168.1.2:5555
Or
adb disconnect
The difference is that first one will disconnect only the required device, the second one will disconnect all the devices.
The benefit of using this command is that you don't have to kill and restart the server. Killing and restarting the server requires your device to be plugged in to your computer which is most irritating process.
For me the reason is GLOBAL PROXY (A country without international internet). Adb try to connect my device through proxy server.
The emulator is running. But when I write adb shell in my shell I get:
error:device offline
What is the reason for this? How do I get rid of it?
If "adb devices" lists your device but as "offline" chances are your path leads to an old version of adb (eg 1.0.29) which has problems with latest Android 4 devices.
Make sure "adb version" returns 1.0.31 or greater.
Starting with Android 4.2.2, you must confirm on your device that it is being attached to a trusted computer. It will work with adb version 1.0.31 and above.
It happened to me once. I just rebooted the device, and this solved the problem for me.
When I got that same error, I just unplugged and plugged in it and the error disappeared.
Try to run:
adb kill-server
adb start-server
Still device offline, please restart device.
I restarted my computer, and at the same time I rebooted the phone. The adb devices returns fine.
Method 1 :
run this commands in your linux terminal
sudo adb kill-server
sudo adb devices
run this commands in your CMD
adb kill-server
adb devices
"adb devices" result must show any device with id. If instead of id you are getting off-line means you need to give permission in your tab. Once you enable USB Debugging in android and connect the device for the first time you will get an alert dialog for giving permission. If you are not getting any pop-up then click on Revoke USB Permission in Developer option the try once.
Method 2:
Change the device connected mode from Media to Camera, sometimes this helped me.
Method 3 :
Update the adb as well as device drivers.
If you are connecting through USB, unplug and plug it in again.
If you are connecting over WiFi, disable and re-enable WiFi on the phone.
If you are on Linux or Mac, and assuming the offline device is 'emulator-5554', you can run the following:
netstat -tulpn|grep 5554
Which yields the following output:
tcp 0 0 127.0.0.1:5554 0.0.0.0:* LISTEN 4848/emulator64-x86
tcp 0 0 127.0.0.1:5555 0.0.0.0:* LISTEN 4848/emulator64-x86
This tells me that the process id 4848 is still listening on port 5554. You can now kill that process with:
sudo kill -9 4848
and the ghost offline-device is no more!
Make sure you're superuser..
Instead of 'adb start-server' do 'sudo adb start-server', enter your password (it will not echo), press enter.
Then, 'sudo adb devices' and it will show as online.
I came with this condition twice.The first time I used the command "adb kill-server" in my PC, and restarted the android device. It worked. However the second time the method didn't work any more.This time I disconnected and reconnected the network. It worked.
This happened to me running Ubuntu 19.04 and Android 9. I fixed this by turning off developer options then turning it back on. And make sure USB Debugging is allowed in there as well.
Install this tool (link) and try the following code, do not forget to have the device connected and be attentive to any message.
cd .... platform-tools/
adb kill-server
adb start-server
I went to my phone settings>>Developer options>>Debugging and turned on this option:
"Allow ADB debugging in charge only mode" then this problem solved for me.
hope to solve for you too.
for me, it was by enabling USB Debugging in developer option:
just run adb install apk path after and it will works
In my case
adb kill-server
adb connect [ip_address_of_device]
try following solutions
make sure USD debugging & WIFI debugging is enabled in develop options
make sure PC & mobile both connected with same WIFI
if still doesn't work disconnect & reconnect the mobile and run the command again
When I type adb devices command on terminal, it shows device is connected
List of devices attached
0123456789ABCDEF device
But when I type adb logcat command, it hangs with below message
waiting for device
Can anybody tell me what is the problem behind this? I test the device on cts.
I am not pretty much sure if this works for you but can you please try the steps below:
# Kill and restart
$ adb kill-server
$ adb start-server
daemon not running. starting it now *
daemon started successfully *
# Device appears, but is listed as offline
$ adb devices
$ adb logcat
I have also experienced similar problems I think I solved it by having the USB debugging option switched on within Developer Options in Settings.
REPEAT The following steps above, it should work!
Here is yet another potential method to solve this -- in the past, the above solutions will work, but in my case, this time, this was the thing that fixed it:
Plug device into USB
Settings -> Developer Options
Revoke USB Debugging Authorization
Unplug Device
Repeat Step 1
Authorize Device
Repeat Steps 4&5
adb devices
should now show device
adb logcat
should now output logs from device
I had this same problem on Ubuntu 12.04. Thankfully MickeyMicro had the solution that worked for me:
Run the command:
gksudo gedit /etc/udev/rules.d/51-android.rules
Add the following line to the blank file
SUBSYSTEM=="usb", ATTR{idVendor}="2080", MODE="0666" (I used this one on 12.04)
SUBSYSTEM=="usb", SYSFS{idVendor}="2080", MODE="0666" (Another recommended for 10.04)
Save and close gedit.
Run the command:
sudo chmod a+rx /etc/udev/rules.d/51-android.rules
Restart the system.
Run the command:
sudo sh -c "mkdir -p ~/.android; echo 0x2080 > ~/.android/adb_usb.ini; adb kill-server; adb devices"
Verify that you have permissions to access the device. adb devices should return normal response, rather than a "???????????? no permissions" message.
http://forum.cyanogenmod.com/topic/23163-need-help-for-adb-connection-on-ubuntu/
I got Nexus tab today and I had to go to Settings -> About Tablet -> (tap 7 or 8 times) on Build Number.
Then 'Developer Options' showed up above 'About Tablet'.
Next in Developer Options, after enabling USB Debugging I was able to get the logs
For Mac Users:
cd /Applications/Android/sdk/platform-tools
./adb logcat
When I have experienced this infinite "waiting for device" on Windows I had simply forgotten to enable usb-debugging in the developer options of my device.
What OS are you using? It can be a variety of different reasons. Did you make sure you only have either the emulator running or a device attached? If so, you can direct your adb command by using the -d or the -e flag.
I had similar problem on Galaxy S3, with adb running on Ubuntu 11.10 OS. In my case, If I reconnect the device (pull the USB connection and reconnect it), the log cat starts working. This happens only for the first time I connect the device after powering it up. Once logcat starts working, then it continues to work smoothly, without needing to reconnect.
This happend to me on OS X mountain lion. To fix it I had to
open Activity Monitor, filter all processes named "adb" and force quit them (I had 3 running). Then reconnect the device and everything was working again.
On my Samsung Galaxy S4 I had the same problem but after 10-20 seconds a dialog pops up on the phone where I have to accept the debug request
I had a similar problem, but for different reasons. My issue came from programing usb accessory on android, which changes the vid/pid when in accessory mode. The solution for me that worked was the following:
Connect the phone
Run the usb host side accessory mode commands (Example website: http://android.serverbox.ch/?p=262 )
Phone should have reconnected in accessory mode (Ensure the PID has adb: 0x2D01)
adb kill-server
sudo adb start-server (This caused the phone to re-ask auth permission)
adb logcat (In my case I wanted to watch the logs, this now worked in accessory mode)
In my case, I was using an old version of adb, make sure you have the latest version of adb. You can download here, extract and run straight within the folder ./adb.
Please go to the developer options on the phone and click "Revoke USB debugging authorization"
Enable it again and try to get the logs. This is basically waiting for the device to get connected. Make sure to authorize USB access from device as well.
In my case just change the option of USB settings from transferring files to MIDI
Enable USB debugging in Developer options
Set File Transer in USB Preferences
did the trick for me! also running adb as sudo might help.
In my case I was using a device connected with Ethernet that runs Android, and I did these steps to solve the problem.
Before, make sure OTG is on.
$ adb kill-server
$ adb connect [your device IP]
I accepted the connection request on the pop-up that appeared on the device
$ adb devices: to check that the device is connected
$ adb logcat