我认为有一种方法可以通过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.
其他回答
如果您是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连接。
1-为此,我认为你已经安装了最新版本的Android studio。如果没有,你可以从这里下载。
2 -可以在“环境变量”中设置平台工具路径(可选)。
3 -确保你的设备和电脑连接到同一个网络。
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
如果你想在设备上启用无线adb,而不需要连接USB线(root要求):
在设备上安装终端应用程序(如Android终端模拟器) 输入以下内容 苏 Setprop service.adb.tcp.port 5555 停止adbd 开始adbd
因为你已经打开了终端,你可以找到设备的IP地址:
ip addr show
然后在调试环境中运行命令:
adb connect ip.of.the.device
这将使该设备被列为您可能拥有的任何其他模拟器。请注意,在重置设备之前,TCP将保持打开状态。 如果你经常断网,你可能还想安装一个Wi-Fi Keep Alive应用程序。
如果你想要安全,记得在连接到公共网络时关闭TCP。您可以执行以下操作或简单地重新启动设备:
苏 Setprop service.adb.tcp.port -1 停止adbd 开始adbd
虽然有这么多好的答案,这里是我对未来的我的两点意见:P和任何想要快速简单的人。
Mac:
首先使用USB连接设备,并确保调试工作正常。断开任何其他设备并退出模拟器。 打开终端,运行以下脚本 Adb tcpip 5555 Adb connect $(Adb shell ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d: -f2):5555 断开USB连接,设备应可进行WiFi调试
解释:
Adb tcpip 5555命令设备开始监听端口5555上的连接
Adb connect $(_ip_address_fetched_):5555表示连接到_ip_address_fetched_地址的5555端口
其中_ip_address_fetched_包含以下内容:
Adb shell ifconfig使用Adb shell获取Internet配置
Grep "inter "过滤任何以inter开头的行
排除本地主机。
此时,输出应该是这样的:
inet addr :###.###.#.# # #广播地址 :###.###.#.# # #面具:255.255.255.0
awk '{print $2}'获取组件数组的第二部分,用空格分隔(我使用zsh)。
到此为止的输出是
addr :###.###.#.###
Cut -d: -f2用分隔符分割字符串,然后取第二部分。它只会接收你的设备IP地址
这太简单了……
步骤1:
connect mobile to laptop (PC)
find adb path in Eclipse or Go Tast manager (<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Esc</kbd>) -> process -> adb.exe -> right-click -> open file location -> copy the path of the open window (like D:\.....)
步骤2:
open cmd and change directory like C:, D:, E:, and G:
1: C:\Users\UMT>D:
2: D:\> cd (past path of adb) like (ANDROID eclipse\Eclipse Setup\adt-bundle-windows-x86_64-202\sdk\plat-form-tools) and press enter
3: Then type `adb tcpip 5555`. Press <kbd>Enter</kbd> ... make sure your mobile connects to the PC
步骤3:
Open new cmd and same above, go to the adb directory and type
adb connect 192.168.x.x(device ip):5555
press enter now connect it.
设备IP地址:设置中—>关于话机—>状态—> IP地址