Related
I'm able to connect to my phone using adb connect, and I can adb shell also.
But when I go to Run->Device Chooser, there are no devices there.
What should I do to connect my (connected) adb Android Studio?
When I plug it in through USB, it shows up on the list
You can find the adb tool in /platform-tools/
cd Library/Android/sdk/platform-tools/
You can check your devices using:
./adb devices
My result:
List of devices attached
XXXXXXXXX device
Set a TCP port:
./adb shell setprop service.adb.tcp.port 4444
./adb tcpip 4444
Result message:
restarting in TCP mode port: 4444
To init a wifi connection you have to check your device IP and execute:
./adb connect 192.168.0.155:4444
If your Android phone OS version 11 or above
Try this
https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+
Android 10 and below phones
Step 1: Goto your Android sdk folder -> platform tools and copy the whole path
For example: C:\Program Files (x86)\Android\android-sdk\platform-tools
Step 2: Goto command prompt or Android studio terminal
windows users cd C:\Program Files (x86)\Android\android-sdk\platform-tools
Mac Users /Users/<username>/Library/Android/sdk/platform-tools
and press enter
Step 3: Connect your device & system with same wifi.
Step 4: Type adb tcpip 5555 and press Enter.
Step 5: Type adb connect x.x.x.x:5555, replacing the x.x.x.x with your phone IP address.
find out phone IP address
Settings -> About phone -> Status (some phones may be vary)
Note: In case that you connect more than one device, disconnect other phones except the one you need to connect.
Command prompt screen shot:
For mac users -> if you face "adb command not found error" try this link
https://stackoverflow.com/a/50017193/3879847
Try below android studio plugin
Android WiFi ADB
HOW TO
Connect your device to your computer using a USB cable.
Then press the button on the toolbar and disconnect your USB once the plugin connects your device over WiFi.
You can now deploy, run and debug your device using your WiFi connection.
Github Link: https://github.com/pedrovgs/AndroidWiFiADB
NOTE: Remember that your device and your computer have to be in the same WiFi connection.
I used the following steps to successfully debug over wifi connection. I recommend this solution to everybody experiencing problems using integrated solutions like Android WiFi ADB plugin. In my case it failed to keep the Wifi connection to my device after unplugging USB. The following solution overcomes this problem.
1. Connecting device
a. Connecting device using local wlan
If you have a local wlan you can connect your android device and your pc to this wlan.
Then identify the IP address of the android device by looking into its wlan settings.
b. Connecting device directly using a hotspot
I prefer to connect with a hotspot on the device. This is more private and does not open your debugging connection to the (public) wlan.
Create a Wifi hotspot on the Android device
Connect PC to hotspot
On PC look into network connection status of this hotspot connection to find the IPADDRESS of your device.My system showed IPADDRESS 192.168.43.1
2. Create debugging connection
Connect your device to USB.
Issue command adb tcpip 5555 to open a port on the device for adb connection.
Create wireless debugging connection adb connect IPADDRESS. In my case the command looked like adb connect 192.168.43.1
The command adb devices -l should now display two devices if everything is ok. For example:
List of devices attached
ZY2244N2ZZ device product:athene model:Moto_G__4_ device:athene
192.168.43.1:5555 device product:athene model:Moto_G__4_ device:athene
3. Keeping debugging connection
The tricky part comes when unplugging the USB connection. In my case both connections are closed immediately! This may not be the case for all users. For me this was the reason that I could not use Android WiFi ADB plugin for android studio.
I solved the problem by manually reconnecting the Wifi after unplugging usb by
adb connect 192.168.43.1
After that adb devices -lshows a single wifi connected device. This devices shows also up in android studio and can then be selected for debugging. When the connection is unstable you may need to repeat the above command from time to time to reactivate the connection.
Try to run:
adb tcpip 5555
adb connect 192.168.2.4
http://developer.android.com/tools/help/adb.html#wireless
Android wifi ADB was earlier working on my IDE but after Updating Android Studio (my current is Android Studio 3.3) it is not working and always prompt as "Unable to connect to device......Same network"
After spending much time i was unbale to resolve the issue.
Then i tried - WIFI ADB ULTIMATE by
https://github.com/huazhouwang/WIFIADB/tree/master/WIFIADBIntelliJPlugin
It worked for me.
Edit: Now I am using ADB Wi-Fi, which is the simplest and easy-to-use plugin in Android Studio.
You can find information relating to setting up a device over WiFi over by the Android ADB Docs.For devices running Android 11+ see instructions.For devices running Android 10- see instructions
You may need to restart your adb via Android Studio (do it twice for good measure).
0pen android studio and follow this path
Go to -> settings -> plugins -> Click on Browser repositories
after that search for WIFI ADB ULTIMATE then click on install.
First time you have to connect it using USB.
You can check its working on github. For more details kindly refer WIFI ADB ULTIMATE
If you are using a rooted phone then try this application WiFi ADB.
Probably this is the most simplest way to debug on wifi.
I am using this application from many days and it works flawlessly.
I'm using AS 3.2.1, and was about to try some of the plugins, but was hesitant realizing the plugins are able to monitor any data..
It's actually really simple doing it via the Terminal tab in AS:
Turn on debugging over WiFi in your phone
Go to developer options and turn on "ADB over network"
You'll see the exact address and port to use when connecting
Go to the Terminal tab in Android Studio
Type adb tcpip 5555
Type your ip address as seen in developer options i.e. adb connect 192.168.1.101
Now you'll see your device in AS "Select deployment target" dialog
Here are simple steps to implement Android App debugging using ADB over wifi:
Required: You need to connect android device and computer to the same
router via wifi. You can use Android Wifi tethering also.
Step 1: Connect Android device via USB (with developer mode enabled), and check its connection via adb devices.
Step 2: Open cmd/terminal and the path of your ../sdk/platform-tools.
Step 3: Execute command adb devices.
Step 4: Execute command adb -d shell (for device) OR adb -e shell (for emulator). Here you will get the shell access to the device.
Step 5: Execute command ipconfig (Windows command) or ifconfig (Linux command) and check the ip-address of it.
Step 6: Not disconnect/remove device USB and execute command adb tcpip 5000, to open tcpip socket port 5000 for adb debugging. You can open it on any port which is not currently occupied.
Step 7: Now execute command adb connect <ip-address>:<port>. eg: adb connect 192.168.1.90:5000 (where ip-address is device's wifi address and port which you have opened).
Now, run adb device and check the debugging device is now connected wirelessly via wifi.
Happy Coding...!
Got this error?
Most of you are here because you didn't do the first thing that is:
1.Connect our Phone with the PC
2.Keep both PC and device connected to the same WiFi
Then follow all the mentioned steps above.
I successfully debug app through WiFi by following the official site's guide.
Note,
WiFi debugging in Android 11+ is different from Android 10 and lower.
Please update your adb, i.e. Android SDK Platform-tools to the latest version, otherwise you may miss some adb commands like adb pair.
if adb command not found.
-----------------------------
Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install adb
brew install android-platform-tools
---------------------------
Connect the device now.
Enable USB debugging in the Android device
Enable Allow ADB debugging in charge only mode
Connect the device to the computer via a USB port.
Start using adb
adb devices
List of devices attached
DUM0219A21000314 device
the first item is device id.
adb -s <device id> tcpip 5555
adb -s DUM0219A21000314 tcpip 5555
restarting in TCP mode port: 5555
Find the local IP address of your Android device. You can find this information in the quick settings drop-down menu by pressing / long pressing the WiFi icon and then clicking on the WiFi network you are connected to.
adb connect <IP address>:5555
adb connect 192.168.2.2:5555
connected to 192.168.2.2:5555
Don't forget!
Allow ADB debugging in charge only mode
enabled before connecting the device
In Android Studio 3.0.1 > Goto > (Short cut key (Alt+Cltr+S)) Settings > Goto Plugins > Click on Browser repositories... > Search "ADB WIFI" and install the plugin. After the installation restart your android studio.
Click the icon and connect your device.
All of the answers so far, is missing one VERY important step, otherwise you will get "connection refused" when trying to connect.
Step 1:
First enable Developer Options menu on your device, by navigating to the About menu on your device, then tapping the Build menu 5 times.
Step 2:
Then go to the now visible Developer Options menu and enable USB debugging. Yes its a bit odd that you need this for Wifi debuging, but trust me, this is required.
Step 3:
adb connect [your devices ip address]
It should say that you're now connected
Easy Way is with Plugin Android WiFi ADB:
For Android Studio Artic Fox|2020.3.1 Patch 2
Open Android Studio. Go to File/Setting/Plugins and Click on the
MarketPlace. Search for Android Wifi ADB and install it.
The plugin(AndroidWiFiADB) would be installed at path ->
C:\Users\PCUserName\AppData\Roaming\Google\AndroidStudio\Plugins.
Cut the Android Wifi ADB Folder.
Now Paste That AndroidWiFiADB Folder at path -> C:\Program
Files\Android\Android Studio\plugins
Restart Android Studio And Icon Appears on The Right Side of The IDE .
On Windows, save the following lines as xyz.bat
#echo off
adb tcpip 5555
set /p IP="IP Address: "
adb connect %IP%
EXIT /B 0
Run the script, put device IP and you're done!
There is an option in newer version of AndroidStudio which allows you to test app on physical device over WiFi.
Please follow this official post: https://developer.android.com/studio/run/device#wireless
just open settings / plugins / search " Android wifi adb and download it and connect your mobile using usb cabble once and its done
I have a device of local company. The support says that they have no imformation about drivers of my device. Windows 7 automatically found drivers and it can see sd-card of device. But ADB can't see the one. Is there any idea to solve my problem?
Yes if you have an adb supported device, you can first turn the USB debugging on and if windows wont recognize the device you need to install an ADB driver which is provided either by Google USB driver package which comes with android sdk or you can download the adb driver installer from http://adbdriver.com/downloads/
For connecting device in window 7 we require USB driver of your android device.
But If you are using Linux operating system in this case no need of USB driver.
install moborobo in your pc and connect the phone. moborobo will install a suitable driver to your phone. it Worked with my local phone.
try this way.
first kill adb server by below command on command prompt.
adb kill-server
Now again start adb server with following command on command prommpt.
adb start-server
Then try to see you device using below commnad
adb devices
Good day,
I've been using a VMWare android machine and installing .apks on it but after my computer was unexpectedly shut down and tried to re-install a package I've been having the following problem:
$ adb -s 192.168.1.2 install 'myapp.apk'
error: device not found
- waiting for device -
However I was able to connect the VM using adb connect 192.168.1.2 which is the ip currently assigned on the android, (seen it on ctrl+f1 netcfg) and then shows:
connected to 192.168.1.2:5555
$ adb devices
List of devices attached
emulator-5554 offline
192.168.1.2:5555 device
so it appears to be online.
Troubleshooting steps taken before posting:
$adb kill/start-server
Reconfigured the VM Network (I have it bridged and Internet connection works fine).
-Suspending/Shutting down and Restarting VM.
-Restarting Internet connection (Router/PC connections)
Kindly assist with situation or post links of another issue related to mine that I probably did not find (sorry for that..)
Thanks!
Edit: I'm using Fedora as OS, Eclipse for developing
When using an ADB tcp target, the device name specified in the -s parameter must include not only the IP address but the port as well, for example:
adb -s 192.168.1.2:5555 install 'myapp.apk'
(As the android emulator actually talks over TCP behind it's "emulator-####" name, one can test this by connecting to an emulator at the loopback address using the control port plus one, ie, "emulator-5554" can also be reached as a vanilla tcp target via adb connect 127.0.0.1:5555 and then you can install on it with adb -s 127:0.0.1:5555 install whatever)
I thought there was a way to test your applications in development over Wi-Fi. Is this possible?
I'd love to be able to untether my phone and develop wirelessly.
See forum post Any way to view Android screen remotely without root? - Post #9.
Connect the device via USB and make sure debugging is working;
adb tcpip 5555. This makes the device to start listening for connections on port 5555;
Look up the device IP address with adb shell netcfg or adb shell ifconfig with 6.0 and higher;
You can disconnect the USB now;
adb connect <DEVICE_IP_ADDRESS>:5555. This connects to the server we set up on the device on step 2;
Now you have a device over the network with which you can debug as usual.
To switch the server back to the USB mode, run adb usb, which will put the server on your phone back to the USB mode. If you have more than one device, you can specify the device with the -s option: adb -s <DEVICE_IP_ADDRESS>:5555 usb.
No root required!
To find the IP address of the device: run adb shell and then netcfg. You'll see it there.
To find the IP address while using OSX run the command adb shell ip route.
WARNING: leaving the option enabled is dangerous, anyone in your network can connect to your device in debug, even if you are in data network. Do it only when connected to a trusted Wi-Fi and remember to disconnect it when done!
#Sergei suggested that line 2 should be modified, commenting: "-d option needed to connect to the USB device when the other connection persists (for example, emulator connected or other Wi-Fi device)".
This information may prove valuable to future readers, but I rolled-back to the original version that had received 178 upvotes.
On some device you can do the same thing even if you do not have an USB cable:
Enable ADB over network in developer setting
It should show the IP address
adb connect <DEVICE_IP_ADDRESS>:5555
Disable the setting when done
Using Android Studio there is a plugin allowing you to connect USB Debugging without the need of using any ADB command from a terminal.
(No root required) There is one best, easy and with UI method for Android Studio
IntelliJ and Android Studio plugin created to quickly connect your Android device over WiFi to install, run and debug your applications without a USB connected. Press one button and forget about your USB cable.
just install plugin Android WiFi ADB
Download and install Android WiFi ADB directly from
Intellij / Android Studio: Preferences/Settings->Plugins->Browse Repositories
.
Remember! for first time to initialize the device you must have to connect using usb
Alternatively, you can download the plugin from the JetBrains plugin site and install it manually in: Preferences/Settings->Plugins->Install plugin from disk.
You can connect and manage your devices easily....... for more information read here https://github.com/pedrovgs/AndroidWiFiADB
If you want to enable wireless adb on the device without connecting with a USB cable at all (root required):
Install a terminal app on the device (like Android Terminal Emulator)
Type the following
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
Since you already have the terminal opened, you can find the IP address of the device:
ip addr show
Then in your debugging environment run command:
adb connect ip.of.the.device
This will make the device to be listed as any other emulators you might have. Note that the TCP will stay opened until you reset the device.
You might also want to install a Wi-Fi Keep Alive app if you often experience disconnects.
Remember to close the TCP when connecting to public networks if you want to feel safe. You can do the following or simply restart the device:
su
setprop service.adb.tcp.port -1
stop adbd
start adbd
Update :
Starting from Android Studio Bumblebee (2021.1.1) Stable, you can debug over Wifi just pairing the device by just scanning the QR code.
Quoting from the blog post :
ADB over Wi-Fi: Bumblebee includes a simplified flow to connect to
your Android 11 and higher devices over Wi-Fi for deployment and
debugging using ADB. After you enable debugging over Wi-Fi on your
device, select the Pair using Wi-Fi action in the Physical tab of the
new Device Manager to open the pairing wizard. Then follow the steps
provided to pair to a device connected over the same network. Learn
more.
Old post :
With new Android 11 you can debug your apps over WiFi without using an USB cable at all.
Quoting from Android Studio User Guide
Connect to a device over Wi-Fi (Android 11+)
Android 11 and higher support deploying and debugging your app
wirelessly from your workstation using Android Debug Bridge (adb). For
example, you can deploy your debuggable app to multiple remote devices
without physically connecting your device via USB. This eliminates the
need to deal with common USB connection issues, such as driver
installation.
To use wireless debugging, you need to pair your device to your
workstation using a pairing code. Your workstation and device must be
connected to the same wireless network. To connect to your device,
follow these steps:
On your workstation, update to the latest version of the SDK Platform-Tools.
On the device, enable developer options.
Enable the Wireless debugging option.
On the dialog that asks Allow wireless debugging on this network?, click Allow.
Select Pair device with pairing code. Take note of the pairing code, IP address, and port number displayed on the device (see image).
On your workstation, open a terminal and navigate to android_sdk/platform-tools.
Run adb pair ipaddr:port. Use the IP address and port number from step 5.
When prompted, enter the pairing code that you received in step 5. A message indicates that your device has been successfully paired.
none
Enter pairing code: 482924
Successfully paired to 192.168.1.130:37099 [guid=adb-235XY]
(For Linux or Microsoft Windows only) Run adb connect ipaddr:port. Use the IP address and port under Wireless debugging.
I found my answer here:
Connect Android device and adb host computer to a common Wi-Fi network accessible to both. We have found that not all access points are suitable; you may need to use an access point whose firewall is configured properly to support adb.
Connect the device with USB cable to host.
Make sure adb is running in USB mode on host.
$ adb usb
restarting in USB mode
Connect to the device over USB.
$ adb devices
List of devices attached
######## device
Restart host adb in tcpip mode.
$ adb tcpip 5555
restarting in TCP mode port: 5555
Find out the IP address of the Android device: Settings -> About tablet -> Status -> IP address. Remember the IP address, of the form #.#.#.#.
sometimes its not possible to find the IP-address of the android device, as in my case. so u can get it using adb as the following:
$ adb shell netcfg
and the should be in the last line of the result.
Connect adb host to device:
$ adb connect #.#.#.#
connected to #.#.#.#:5555
Remove USB cable from device, and confirm you can still access device:
$ adb devices
List of devices attached
#.#.#.#:5555 device
You're now good to go!
If the adb connection is ever lost:
Make sure that your host is still connected to the same Wi-Fi network your Android device is.
Reconnect by executing the "adb connect" step again.
Or if that doesn't work, reset your adb host:
adb kill-server
and then start over from the beginning.
The adb utility does have the ability to connect to a device over TCP/IP. However, adbd is not normally listening for TCP connections.
If you want to get it running, you need an engineering device (in other words, you need root). Then follow the directions in this post:
How can I connect to Android with ADB over TCP?
Since this only works on eng devices, it's not officially supported. Use at your own risk, expect bugs, etc.
For all , this , there exists a better method (EASIEST METHOD) :
1 ) A plugin for Android studio exits , called Android wifi ADB
2) Go to file -> settings -> Plugins -> Browse Repositories
3) Look for Android WiFi ADB , click on INSTALL , and then restart on prompt
4) You will see a new icon , which is your new plugin .
Now to make this work :
5) Go to your phone's developer option and enable DEBUGGING (must)
6) Also enable , ALLOW DEBUG OVER TCP/NETWORK
7) Attach your phone via USB , and make sure , both phone and your pc/laptop are connected to the same network (either hotspot or wifi)
8) CLICK ON THE NEW ICON (ie your ANDROID Wifi ABD)
9) Your phone get's detected and get's connected over wifi/hotspot , and hence now you may disconnect the usb . This is a one time process , hence you may not need to keep phone connected over usb .
This will save your phone from irregular charges and also , a remedy for short length usb cables .
In Developer options of Android 11, there is Wireless debugging. Make sure your laptop and phone under same network then execute 2 command below. Note that, the port for pair is different to the port for connect and you just need to pair on the first time (later you just need connect).
adb pair ipaddr:port
adb pair 192.168.1.6:42049
// will output
Enter pairing code: 696686
Successfully paired to 192.168.1.6:42049 ...
adb connect ipaddr:port
adb connect 192.168.1.6:37203
// will output
connected to 192.168.1.6:37203
Addition
These command will only work on android studio terminal, if you are in "platform-tools" directory. cd C:\Users\username\AppData\Local\Android\Sdk\platform-tools>
Install plugin Android WiFi ADB
Download and install Android WiFi ADB directly from Android Studio:
File > Settings->Plugins->Browse Repositories-> Android WiFi ADB ->Install ->Connect with cable for first time -> Click on "Connect" -> Now remove cable and start doing debug/run.
Check ss for your reference :
If you are using Android 11 click on the build version many times to activate the developer option then go to Settings>Advanced>Developer options. Scroll to debugging and turn on the "Wireless debugging" checkbox. Then open the menu debugging by touching the "Wireless debugging". Select "Pair device with paring code" and you will see the address for pairing with a pairing code. write this command in your desktop terminal to pair with your Android device.
adb pair 192.168.XXX.XXX:XXXX <--------- the address showing on screen under paring code
Use the paring code to connect.
But wait we are not connected to adb yet.
After you have successfully paired your device once. You can connect your adb anytime you turn on your Wireless debug option. To connect your adb every time before you use it from now on you don't need the pairing address anymore instead you will use the given address that shows when you enter the Wireless debug menu.
adb connect 192.168.XXX.XXX:XXXX <--- this address shows inside wireless debug menu
After a long search I found :
I must run
adb connect <device_ip_address>:5555
after disconnecting USB.
I wrote a shell script which can let you debug an Android device via Wi-Fi.
Here is the code:
#!/usr/bin/env bash
#Notice: if unable to connect to [ip]:5555,
#try adb kill-server then try again.
adb shell ip route > addrs.txt
#Case 1:Nexus 7
#192.168.88.0/23 dev wlan0 proto kernel scope link src 192.168.89.48
#Case 2: Smartsian T1,Huawei C8813
#default via 192.168.88.1 dev eth0 metric 30
#8.8.8.8 via 192.168.88.1 dev eth0 metric 30
#114.114.114.114 via 192.168.88.1 dev eth0 metric 30
#192.168.88.0/23 dev eth0 proto kernel scope link src 192.168.89.152 metric 30
#192.168.88.1 dev eth0 scope link metric 30
ip_addrs=$(awk {'if( NF >=9){print $9;}'} addrs.txt)
echo "the device ip address is $ip_addrs"
echo "connecting..."
rm addrs.txt
adb tcpip 5555
adb connect "$ip_addrs"
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.
Now, you are good to go!
To complete the answer of #usethe4ce, if you have more than one device or emulators, the adb tcpip 5555 will give error: more than one device/emulator.
In this case you need to give the serial number of the desired device:
adb devices
List of devices attached
33001229 device
emulator-5554 device
adb -s 33001229 tcpip 5555
Find your device's IP in my case I can find it from the device's wifi connected settings.
adb connect xxx.xxx.xxx.xxx:5555
For Windows:
Step 1. Make a batch file with the below commands and call the file w.bat.
Step 2. Copy the below contents in w.bat, and save it in any of the folders which are in %path% of your Windows system
echo ***Get phone in Wi-Fi mode***
echo ***Get phone in Wi-Fi mode***
adb devices
echo ***Remove cable from the phone now***
adb tcpip 9000
adb connect 192.168.1.1:9000
adb connect 192.168.1.2:9000
adb connect 192.168.1.3:9000
adb connect 192.168.1.4:9000
adb connect 192.168.1.5:9000
adb connect 192.168.1.6:9000
//<-- Till here -->
Step 3. Connect your phone and PC with a cable
Step 4. Ensure the phone is in Wi-Fi mode
Step 5. Remove the cable when the batch file tells you to
Step 6. Type w.bat on the Windows prompt (start -> run -> type CMD, press Enter) (black screen is Windows DOS prompt), if you copied it in one of the path folders then you can run from anywhere, else run from the folder where you created this file.
The output of the batch file will be something like this:
C:\Windows\System32>w
C:\Windows\System32>echo ***Get phone in Wi-Fi mode***
***Get phone in Wi-Fi mode***
C:\Windows\System32>echo ***Get phone in Wi-Fi mode***
***Get phone in Wi-Fi mode***
C:\Windows\System32>adb devices
List of devices attached
d4e9f06 device
C:\Windows\System32>echo ***Remove cable from the Phone now***
***Remove cable from the Phone now***
C:\Windows\System32>adb tcpip 9000
restarting in TCP mode port: 9000
C:\Windows\System32>adb connect 192.168.1.1:9000
unable to connect to 192.168.1.1:9000:9000
C:\Windows\System32>adb connect 192.168.1.2:9000
connected to 192.168.1.2:9000
C:\Windows\System32>adb connect 192.168.1.3:9000
unable to connect to 192.168.1.3:9000:9000
C:\Windows\System32>adb connect 192.168.1.4:9000
unable to connect to 192.168.1.4:9000:9000
C:\Windows\System32>adb connect 192.168.1.5:9000
unable to connect to 192.168.1.5:9000:9000
C:\Windows\System32>adb connect 192.168.1.6:9000
unable to connect to 192.168.1.6:9000:9000
Note 1: Find this in the output, (ignore all ->unable to connect<- errors)
connected to xxx.xxx.x.x:9000
If you see this in the result, just remove the cable from PC and go to Eclipse and run to install the app on the device; that should be it.
Note 2: DISCONNECT OR TO SWITCH WIRELESS MODE OFF: Type the below command. It should say restarting in USB mode - at this stage PC and computer should NOT be connected with a cable:
C:\Users\dell>adb usb
restarting in USB mode
Note 3: Steps to find the IP address of the phone (taken from Stack Overflow)
Find IP address of MY PHONE:
a. Dial *#*#4636#*#* to open the Testing menu.
b. In the Wi-Fi information menu: click Wi-Fi Status
c. Wi-Fi status can be blank for the first time
d. Click Refresh Status
e. In the IPaddr: <<IP ADDRESS OF THE PHONE IS LISTED>>
Note 4: My Phone Wi-Fi connection IP address range typically is as the mentioned IP addresses below,
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
192.168.1.6
Note 5: if you get any other sequence of IP addresses which keep getting reassigned to your phone, you can just change the IP address in the w.bat file.
Note 6: This is a brute-force method, which eliminates all manual labor to keep finding IP address and connecting to Eclipse / Wi-Fi.
SUCCESS Note 7: So in short, the regular activity would be something like this:
Step 1. Connect PC and Wi-Fi via a cable
Step 2. Start CMD - to go to Windows DOS prompt
Step 3. Type "w"
Step 4. Find connected command in the output
Step 5. Success, remove cable and start using Eclipse
Best and super easy way to do this is:-
Make a batch file :-
adb devices
adb tcpip 5555
adb connect 192.168.9.120:5555 ( Your phone ip xxx.xxx.x.xxx:5555 )
Place this file into your android sdk platform-tool folder.
Example:- C:\Users\'user_name'\AppData\Local\Android\Sdk\platform-tools
Right click file > sendto > Desktop(create shortcut )
That's it....
Now you just need to connect your phone through USB , then open desktop shortcut and disconnect your phone...
Though there are so many good answers, here is my two cents for the future me :P and for anyone who wants it quick and easy.
For Mac:
connect the device using USB first and make sure debugging is working. Disconnect any other devices and quit emulators.
open terminal and run the following script
adb tcpip 5555
adb connect $(adb shell ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d: -f2):5555
disconnect USB connection and the device should be available for WiFi debugging
Explanation:
adb tcpip 5555 commands the device to start listening for connections on port 5555
adb connect $(_ip_address_fetched_):5555 tells to connect on port 5555 of the _ip_address_fetched_ address
where _ip_address_fetched_ includes following:
adb shell ifconfig getting internet configurations using adb shell
grep "inter " filter any line that starts with inter
grep -v 127.0.0.1 exclude localhost.
At this point, output should be like:
inet addr:###.###.#.### Bcast:###.###.#.### Mask:255.255.255.0
awk '{print $2}' get the second part of the components array, separated by space (I'm using zsh).
The output up to this point is
addr:###.###.#.###
cut -d: -f2 split the string by delimiter : and take second part. It will only take your device IP address
In Device Settigs-> "Developer options" -> "Revoke USB debugging authorizations".
Connect the device via USB and make sure debugging is working.
adb tcpip 5555
adb connect <DEVICE_IP_ADDRESS>:5555
Disconnect USB
adb devices
From search and from some answers i use this method and it work fine
and you must know that tcpip is not always 5555 , you must find it just follow this
you need first to download platform-tools
https://developer.android.com/studio/releases/platform-tools.html
extract platform-tools folder to C drive and run Powershell there (Right click >> PowerShell >> Open here)
#Connect phone with usb cable
PS C:\platform-tools> adb kill-server
PS C:\platform-tools> adb shell ip route > addrs.txt
#this give you your tcpip
* daemon not running; starting now at tcp:5037
* daemon started successfully
PS C:\platform-tools> adb tcpip 5037
restarting in TCP mode port: 5037
#Disconnect phone
#adb connect <phone_ip>:5037
PS C:\platform-tools> adb connect 192.168.43.1:5037
connected to 192.168.43.1:5037
Now you can see your phone in Android studio
>## open command prompt with Run as Administrtor ##
adb connect ipdevice:5037
The best way is using ADBConnect (Eclipse plugin) and ADB Wireless (app for Android device).
For Ubuntu / Linux:
Make sure your device is working for debugging: http://developer.android.com/tools/help/adb.html#Enabling
Go to your sdk folder and find the folder platform-tools
Use ./adb devices to list the connected devices. Make sure it is only one device connected and no emulator running.
Find your device IP address, you can find it in your device:
http://developer.android.com/tools/help/adb.html#wireless, or got adb shell like this: ./adb shell then netcfg. You will see a list of IP addresses. Find wlan0, in my case 192.168.100.3/2.
./adb tcpip 5555
Finally enter ./adb connect <Your device IP Address>:5555 in your terminal. You can now deploy the application to your device over Wi-Fi.
Note :- Android Phone must be rooted and no need of usb cable.
Install wifi adb in android phone from playstore
link :-https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb
For Windows
I am using this technique , which is very easy.
1) download adb :
link : https://www.dropbox.com/s/mcxw0yy3jvydupd/adb-setup-1.4.3.exe?dl=0
2) Run exe :- when you see blue screen press y enter .
3) Now open your wifi adb apk , just grant root permission and must be remember you android phone and system on the same network by wifi or hotspot .
4) Open Wifi adb apk , you will get some ip address like , adb connect 192.168.2.134:5555
Note this ip may be very from system to system , now put this information to your command prompt and hit Enter .
5) Open cmd from anywhere enter adb connect 192.168.2.134:5555 .
6) Finally you successfully connected to adb . it will show message like
connected to 192.168.2.140:5555
For Mac Os
This is the easiest way and will provide automatic updates.
1)Install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2)Install adb
brew cask install android-platform-tools
3)Start using adb
adb devices
4) Open Wifi adb apk , you will get some ip address like , adb connect 192.168.2.134:5555 Note this ip may be very from system to system , now put this information to your terminal and hit Enter .
5) Open terminal in mac os from anywhere enter adb connect 192.168.2.134:5555 .
6) Finally you successfully connected to adb . it will show message like connected to 192.168.2.140:5555
I hope its help you ,Thank You !
If you are a windows user and your android sdk is located at C:\Users\%username%\AppData\Local\Android\Sdk then you can follow this method. If your andoid sdk not located there, replace that path to the below code.
#echo off
"C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools\adb.exe" disconnect
"C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools\adb.exe" shell ip route > %temp%\addrs12321.txt
For /F "UseBackQ Delims==" %%A In ("%temp%\addrs12321.txt") Do Set "lastline=%%A"
FOR %%C IN (%lastline%) DO SET last=%%C
"C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools\adb.exe" tcpip 5555
"C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools\adb.exe" connect %last%:5555 > %temp%\adbresult.txt
set /p result=<%temp%\adbresult.txt
del /f %temp%\addrs12321.txt
echo MSGBOX "%result%" > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q
del %temp%\adbresult.txt /f /q
Step 1.
Turn on usb debugging,
Connect your phone to windows machine
select file transfer in usb options menu in android menu (if found)
Step 2.
copy above code
save as its extension like .bat, eg filename.bat
double click on the file you saved. done
note you can connect any time by running that file while the device
being connected with the pc with usb debugging is turned on.
One imp point probably missed here - once you do a adb remount - the TCP connection is lost hence you have to do a adb connect IP:port once over again
Connect the device via USB and make sure debugging is working. these steps are taken if you already have installed adb and set it's path in environment varialbe
open cmd and type the following
adb tcpip 5555
find the IP address with adb shell ip route
adb connect DEVICE_IP_ADDRESS:5555
Disconnect USB and proceed with wireless debugging.
I wrote a simple script for Windows:
Step 1. Make a batch file with the below commands and call the file wifi_dedug.bat and copy the below contents:
adb tcpip 5555
pause
adb shell "ip addr show wlan0 | grep 'inet ' | cut -d' ' -f6|cut -d/ -f1" > tmpFile
pause
set /p ip= < tmpFile
#echo %ip%
del tmpFile
#echo %ip%
adb connect %ip%
pause
Step 2. connect your device to pc.
Step 3. start batch file (key enter when requested)
Step 4. disconnect your device and deploy/debug via wifi.
1- For this I am considering you have already installed the latest version of Android studio. If not you can download it from here.
2 - You can set the platform tools path in environment variable (optional).
3 - Make sure your device and pc connected to same network.
plug in the data cable from pc to device.
Now, type adb tcpip 5555
remove data cable.
Then type adb connect 192.168.43.95
here 5555 is the port number and 192.168.43.95 is the ip address of the mobile device you can get id address from the mobile settings .
Then go to About device and go to status you can see the ip address of the device.
You can connect multiple device from different ports which can give ease in development.
Or you can go to this link for brief description with screenshots. http://blogssolutions.co.in/connect-your-android-phone-wirelessly-by-adb
Edit August 2021
Google removed it with ArcticFox Beta 03 https://issuetracker.google.com/issues/190411383 but in Android Studio Bumblebee it's still there. It looks like they have to much issues with it, that's why it's just in canary builds
Original post
This Android WiFi ADB plugin doesn't work in 4.1.1 (anymore)
But there is much more simple solution:
If you have an Android 11 (api30) device you should use Android Studio 2020.3.1 (Canary) to connect. It's super easy
Then you go to developer settings and scan QR code. That's it.
You can use connected device in other (older) Android Studio version now as well
Steps for Android Wifi debugging with ADB:
$> adb devices // check all usb debuggable devices connected.
$> adb -d shell // Access device shell.
shell> ifconfig // Check and copy wifi ip-address eg:192.168.1.90
shell> exit // Exit from android device shell.
$> adb tcpip 5000 // open TCP port 5000 (or any available)
$> adb connect 192.168.1.90:5000 // connect to device via wifi ip over specific TCP port.
$> adb devices // you will get debuggabled android device over wifi.
Required: Connect your android device to computer via USB with
developer mode enabled. Also connect your android device and computer
to same wifi router (or use tethering).
Is it possible to write the code/compile Android application on one machine and debug it remotely on the emulator launched on another? I'm sick and tired of the emulator constantly eating half of my laptop's CPU.
I haven't previously tried (or even noticed) the adb connect command that cmb mentioned, but I can confirm that forwarding the TCP ports yourself — such as over SSH — works fine.
The emulator listens on two TCP ports per instance: 5554 for the telnet interface and 5555 for control communication with tools like DDMS. So you could probably get away with only forwarding port 5555 (though I've only tried it so far with both). Each subsequent emulator takes the next available even+odd port number tuple (up to around 5580, I think).
For reference, I did the following steps on my local machine:
ssh -NL 5554:localhost:5554 -L 5555:localhost:5555 myuser#remote-server
killall adb; adb devices
I believe the emulator tries to notify a local adb server at startup; hence the need to restart adb in order for it to probe the local 5554+ ports.
Note that the localhost in the ssh command refers to the local interface of the remote machine.
adb devices showed a new emulator — emulator-5554 — and I could use it as if it were running on my local machine.
I realize this question is really old, but I solved the problem slightly differently, and it took me a while to figure out this trivial solution.
I usually use a Windows7 PC or laptop (depending on where I'm working) as my front-end because I like the GUI, however I prefer to do all of my edit/compile/debug on a headless Ubuntu server because of all the command-line power it provides. My goal is to make each windows system as much of a thin-client as possible without any extra services (such as sshd) or firewall holes.
So here is the senario:
System-A: Windows7 system with android emulator running
System-B: Ubuntu server with SDK installed
The problem as described earlier is that the emulator on System-A binds to localhost, not the external ethernet interface, so adb on the System-B cannot access the emulator on System-A. All you need to do is set up remote port forwarding in PuTTY for your SSH connection to System-B. The trick is to check the "Remote" radio button when you create the two tunnels so that the tunnel direction is reversed (tunneling from the server you are logging into to the client you are logging in from).
Finally, connect with adb to "localhost" on System-B after establishing the SSH connection:
System-B$ adb connect localhost
connected to localhost:5555
System-B$ adb devices
List of devices attached
localhost:5555 device
Now you can download images/debug as normal, and it is a trivial matter to switch to a different Windows system if you want to take your laptop out and get some coffee.
In addition, by also tunneling port 5037 in the same manner you can actually forward your adb server connection so that you can connect a real android device over USB on System-A, and download images to it from System-B. In order for this to work, you need to make sure that the adb server is running on System-A, and not running on System-B before starting your SSH session:
First, start the adb server on System-A (command prompt)
C:\> adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
C:\> adb devices
List of devices attached
3435F6E6035B00EC device
Next, kill the adb server on System-B
System-B$ adb kill-server
Finally, restart your ssh session to System-B and verify
System-B$ adb devices
List of devices attached
3435F6E6035B00EC device
Here is how I solved it on Windows. I pretty much followed Christopher's lead, but I can't edit, so a new answer will have to do.
The problem I had was that ADB as well as the emulator was just listening on 127.0.0.1, not 0.0.0.0, for me. Otherwise I would have used TCPMon. I guess this is either different on Windows, or has changed with the latest versions of the SDK. (You can check with netstat -ban.)
I installed WinSSHD on the machine that runs the emulator. (I believe it should work with freeSSHd as well, but I couldn't get a login working there.)
I opened port 22 (TCP) in the Windows Firewall. (WinSSHD might be able to do that for you.)
I created a virtual account in the WinSSHD GUI.
I created a new PuTTY connection from the development machine to the emulator machine and made sure I could connect.
Then I set up tunnelling in PuTTY: Connection -> SSH -> Tunnels
Source port: 5554
Destination: localhost:5554
Type: Local/Auto
Source port: 5555
Destination: localhost:5555
Type: Local/Auto
(Connect and keep PuTTY open, to maintain the tunnel.)
Now I fired up the emulator on the remote machine and made sure that ADB is not running there.
I restarted ADB on the development machine (adb kill-server, then adb start-server).
adb devices and the remote emulator showed up as emulator-5554 device. I could now deploy and run my app straight from Eclipse/ADT, where the emulator showed up under Virtual Devices as if it was a local emulator.
I found an easy way to do this if your two machines are in the same private network and therefore do not need to use SSH encryption (which is the common case). This may help as an SSH tunnel can be quite long and difficult to install. For example, installing an SSH daemon under Cygwin / Windows for the first time may lead to give up (well, I gave up).
Under Windows, what follows requires having Cygwin installed with the package httptunnel. This must work under Linux / httptunnel as well but I didn't try.
Run the emulator on one of the machines (let's say its host name is HostEmulator)
Start Eclipse on the other machine (let's call it HostEclipse)
Open a Cygwin terminal on each machine, and then,
On HostEmulator, enter the following cygwin commands:
hts -F localhost:5554 10000
hts -F localhost:5555 10001
hts means Http Tunnel Server.
These two commands create two half-bridge that listen to the ports 10001 and 10001 and that redirect the I/O of these ports to the local ports 5554 and 5555, which are the ports used by the emulator (actually, the first lauched emulator - if you are several of them running they will use higher port numbers as seen in other replies of this page).
On HostEclipse, enter these ones:
htc -F 5554 HostEmulator:10000
htc -F 5555 HostEmulator:10001
htc means Http Tunnel Client.
These commands create the missing half-bridges. They listen to the local ports 5554 and 5555 and redirects the I/O of these ports to the half-bridges we have created on HostEmulator just before.
Then, still on HostEclipse, enter these three commands:
adb kill-server
adb start-server
adb devices
This restarts adb as it doesn't detect the remote emulator otherwise. It must be doing some scanning at startup. And then it lists the devices (the available emulators) just for checking.
And there you go.
You can work with your remote emulator as if it was local.
You have to keep the Cygwin terminals open on both machine otherwise you would kill the half bridges you created.
I used the port 10000 and 10001 for the machine/machine exchanges here, but of course you can use other ports as long as they are not already in use.
None of the proposed solutions worked for me.
I've started from Emirikol's solution and refined it, as with the new Android API > 21 the emulator was appearing offline and I had to go to Genymotion settings and leave Android SDK path empty.
And from command line:
netsh interface portproxy add v4tov4 listenport=5555 connectport=5555 connectaddress=<emulatorIP>
netsh interface portproxy add v4tov4 listenport=5554 connectport=5554 connectaddress=<emulatorIP>
source:http://www.sarpex.co.uk/index.php/2016/10/02/connect-genymotion-emulator-remotely/
Disclaimer, I'm the author.
When you run adb, it starts a server copy of itself if one isn't already running.
You can start that copy yourself on the machine with the device and since sdk 4.3 you can give it the -a option to tell that server to listen for remote machines. Do that with the following command which doesn't exit:
adb -a -P 5037 server nodaemon
On the machine you want to use the device from, set ADB_SERVER_SOCKET to tcp:xxxx:5037 in an environment variable (or give the same value to each adb invocation with the -L option), where xxxx is the IP address or hostname of the machine with the devices, and 5037 matches the port you gave the in the command above.
We use this to give access to about 100 emulators spread over 3 machines to a machine running end to end tests in parallel, and to developers wanting to share real devices remotely.
You can forward ports to and from the emulator with adb forward and adb reverse, and they'll appear on the machine with the devices (not the machine you're running 'adb forward' from).
My solution for windows + AndroVM (which requires a host-only adapter) when my ssh service failed to start. so it doesn't require any additional software.
adb connect <Andro VM IP>
adp tcpip 555
On cmd prompt run as admin:
netsh interface portproxy add v4tov4 listenport=5555 listenaddress=<host ip> connectport=5555 connectaddress=<Andro VM IP>
open TCP port 5555 in windows firewall.
Then, from the second PC run:
adb connect <host ip>
This post contains many answers but step by step instructions are missing.
So this answer will explain how to connect 2 computers to run projects of one computer on the emulators of another computer.
Requirements before going further:
Firewall should be off in both the PCs.
Both PCs must be connected in the same network.
Notes:
Computer running Android Studio is mentioned as "PC_AS"
Computer running Emulator is mentioned as "PC_EM"
Step 1:
On the computer running Android Studio, open a terminal window and run following command.
ssh -NL 5554:localhost:5554 -L 5555:localhost:5555 dhaval#192.168.0.104
Above command will forward 5554 and 5555 ports of PC_AS to the same ports on PC_EM. So the emulators running on PC_EM can be detected on the PC_AS.
dhaval#192.168.0.104 is the address of the PC_EM. Format of the address is username#local_ip_address
Once you run above command, the terminal window will not show anything if the command is executed successfully. It will look like nothing is going on but the process is running there.
| 💡 Note: Do not close this terminal until you want to stop remote debugging.
Step 2:
Now open another terminal window on PC_AS and run following commands one by one.
killall adb;adb devices
This command will stop the adb and stop the server.
adb start-server
This command will start the adb server.
adb devices
This command will list down all the connected adb devices.
Once you run above commands, you will see that emulators of PC_EM are now detected in the PC_AS. Now you can run the projects on those emulators and debug remotely.
| 💡 Note: While doing the above process, emulators can show a dialog to trust the incoming request.
Android emulators by default listens on local port 5555, so one way to connect to a remote emulator is by using a port forwarding tool to forward all LAN packets to local 5555 port.
One such excellent tool is Trivial Port Forward
Here is the command:
trivial_portforward.exe 1234 127.0.0.1 5555
Here 1234 is the port number where the development computer will connect. 127.0.0.1 is loopback address and 5555 is the emulator’s port.
For more detailed example, see my blog post.
This is how I made it work from host macOS with emulator to macOS client.
A: One line command
On host of emulator
socat tcp-l:5560 tcp:localhost:5559
On client
adb connect <IP>:5560
B: With a tunnel
on host with Emulator
host$ adb kill-server
host$ adb -a nodaemon server
on client with Android Studio
client$ adb kill-server
client$ ssh -L 5037:localhost:5037 <host-IP>
open second shell on client with Android Studio
client$ adb kill-server # I observe first it kills client adb
client$ adb kill-server # then it kills server adb, do it maybe once more
client$ adb devices # show devices on server now
Now I see host emulator in Android Studio as well
I don't have a second machine with the SDK to hand, but I note that the emulator's listen ports (default 5554, 5555) are listening on 0.0.0.0, i.e. reachable from remote machines, and that adb --help shows a connect <host>:<port> command. I assume that would make it show up in adb devices so adb commands work on it. For Eclipse, try "Run / Run Configurations..." and set the Target to Manual. That gives you a "device chooser" which I'm guessing would include a remote emulator if adb is connected to it. Worth a try.