我认为有一种方法可以通过Wi-Fi测试开发中的应用程序。这可能吗?
我希望能够解开我的手机,无线开发。
我认为有一种方法可以通过Wi-Fi测试开发中的应用程序。这可能吗?
我希望能够解开我的手机,无线开发。
当前回答
更新:
从Android Studio Bumblebee(2021.1.1)稳定版开始,你可以通过扫描二维码对设备进行Wifi调试。
引用博客文章:
通过Wi-Fi的ADB: Bumblebee包括一个简化的连接流程 你的Android 11和更高版本的设备通过Wi-Fi进行部署 使用ADB调试。在你的 的“物理”选项卡中选择“使用Wi-Fi动作的对” 新建设备管理器打开配对向导。然后按照下面的步骤 提供用于与通过同一网络连接的设备配对。学习 更多。
老帖:
有了新的Android 11,你可以在WiFi上调试你的应用程序,而完全不需要使用USB线。
引用自Android Studio用户指南
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.
其他回答
这里可能漏掉了一个imp点-一旦您执行adb重新挂载- TCP连接丢失,因此您必须再次执行adb连接IP:port
android无线调试(MAC)
步骤1:进入sdk文件夹(常用路径“/Users/macname/Library/Android/sdk/platform-tools”) 打开CMD,运行"adb devices" output -附加设备列表
如果在CMD类型中没有找到adb命令 。/亚洲开发银行——的帮助 OS X / macOS:典型的~/。Profile或~/.bash_profile 在这里添加以下一行,并将其替换为安装platform-tools的路径:
步骤2: $PATH ="/Users/macname/Library/Android/sdk/platform-tools"
步骤3: $ adb设备 所附设备清单 ZH99FF7FTY设备
步骤4: $ adb tcpip 5555 以TCP模式重新启动端口:5555
步骤5: $ adb connect 10.124.32.18:5555 已连接到10.124.32.18:5555
下次重复步骤4和5重新连接 或者如果设备重新启动但没有连接,请再次执行步骤 祝你好运
我通读了每一个答案,发现没有使用android和根的方法。(使用android 11)
1)。使用termux,我安装了android-tools包,这很容易遵循termux的wiki。
2)打开设置->无线调试:并切换无线调试
3.)单击“配对设备与配对码”。
4)。使用设置应用程序和termux启用分屏。在termux中(设置应用程序仍然打开)输入命令adb pair ip:port(这里的端口就是你在上面的分屏中看到的端口)
5.)它会问你一个代码,再次使用你看到的分屏设置应用程序。
6.)在termux中输入命令adb connect ip:port(确保端口是你上面看到的端口,因为它可能与你刚刚输入的端口不同)
整个过程可以自动使用任务器,我不会张贴在这里,因为我发现它快速和容易手动完成,但任务器的创造者有一个指南在这里的某个地方。
经过长时间的搜索,我发现:
我得走了
adb connect <device_ip_address>:5555
断开USB后。
如果您是windows用户,并且您的android sdk位于C:\Users\%username%\AppData\Local\ android \ sdk,那么您可以遵循此方法。如果你的andoid sdk不在那里,将该路径替换为下面的代码。
@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
步骤1。
打开usb调试, 把你的手机连接到windows电脑上 在android菜单的usb选项菜单中选择文件传输(如果找到)
步骤2。
复制以上代码 保存为扩展名,如。bat,如filename.bat 双击您保存的文件。完成
请注意,您可以通过在设备运行该文件来随时连接 打开usb调试与PC连接。