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

前端 未结 30 1804
[愿得一人]
[愿得一人] 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:56

    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:

    1. On your workstation, update to the latest version of the SDK Platform-Tools.
    2. On the device, enable developer options.
    3. Enable the Wireless debugging option.
    4. On the dialog that asks Allow wireless debugging on this network?, click Allow.
    5. Select Pair device with pairing code. Take note of the pairing code, IP address, and port number displayed on the device (see image).
    6. On your workstation, open a terminal and navigate to android_sdk/platform-tools.
    7. Run adb pair ipaddr:port. Use the IP address and port number from step 5.
    8. 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] 
    
    1. (For Linux or Microsoft Windows only) Run adb connect ipaddr:port. Use the IP address and port under Wireless debugging.

提交回复
热议问题