Run/install/debug Android applications over Wi-Fi?

前端 未结 30 1637
[愿得一人]
[愿得一人] 2020-11-22 07:16

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.

相关标签:
30条回答
  • 2020-11-22 07:40

    When you follow the above answer https://stackoverflow.com/a/10236938/6117565, you might get the error "No route to host".

    To fix that, before step 5 in the above answer, first, start your emulator then try the connecting device. Don't know what is happening but this trick works.

    0 讨论(0)
  • 2020-11-22 07:45

    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.

    0 讨论(0)
  • 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).

    0 讨论(0)
  • 2020-11-22 07:46

    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 :

    0 讨论(0)
  • 2020-11-22 07:46

    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.

    1. Connect the device once through USB.
    2. Refresh the list to check whether its connected.
    3. Go to About Phone > Status > IP Address and note your IP address(e.g. 198.162.0.105).
    4. 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!

    0 讨论(0)
  • 2020-11-22 07:46

    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

    0 讨论(0)
提交回复
热议问题