无线连接手机ADB

 

#1楼

要仅通过一个命令在TCP和USB模式之间切换,可以将其添加到/init.rc :

on property:service.adb.tcp.port=*
    restart adbd

on property:service.adb.tcp.enable=1
    setprop service.adb.tcp.port 5555

on property:service.adb.tcp.enable=0
    setprop service.adb.tcp.port -1

现在,您可以使用属性service.adb.tcp.enable启用或禁用端口5555上的侦听。运行netstat来检查其是否在侦听。 如您所见,如果您希望手动更改service.adb.tcp.port它也会触发。


#2楼

我发现其他答案令人困惑。 使用adbWireless简单得多:

http://ppareit.github.com/AdbConnect/

只需在手机上安装一个应用程序即可切换wifi调试,然后安装eclipse插件即可。


#3楼

我整理了一个批处理文件,用于通过TCP自动启用ADB并将其连接到通过USB连接的设备。 有了它,您不必手动输入IP。

@echo off
setlocal

REM Use a default env variable to find adb if possible
if NOT "%AndroidSDK%" == "" set PATH=%PATH%;%AndroidSDK%\platform-tools

REM If off is first parameter then we turn off the tcp connection.
if "%1%" == "off" goto off

REM Set vars
set port=%1
set int=%2
if "%port%" == "" set port=5557
if "%int%" == "" set int=wlan0

REM Enable TCP
adb -d wait-for-device tcpip %port%

REM Get IP Address from device
set shellCmd="ip addr show %int% | grep 'inet [0-9]{1,3}(\.[0-9]{1,3}){3}' -oE | grep '[0-9]{1,3}(\.[0-9]{1,3}){3}' -oE"
for /f %%i in ('adb wait-for-device shell %shellCmd%') do set IP=%%i

REM Connect ADB to device
adb connect %IP%:%port%

goto end

:fail
echo adbWifi [port] [interface]
echo adbWifi off
goto end

:off
adb wait-for-device usb

:end

#4楼

使用TCP端口连接平板电脑。 确保您的系统和设备连接到同一网络。

  1. 打开控制台cmd.exe
  2. 键入adb tcpip 5555
  3. 转到系统->开发选项-> USB调试 ->取消选中TCPIP连接
  4. 键入adb connect 192.168.1.2这是您的设备IP地址
  5. 连接到192.168.1.2

使用端口转发连接尝试做端口转发,

adb转发tcp: <PC port> tcp: <device port>

喜欢:

 

亚行转发tcp:5555 tcp:5555。 

C:\\ Users \\ abc> adb转发tcp:7612 tcp:7612 

C:\\ Users \\ abc> adb tcpip 7612在TCP模式下重新启动端口:7612 

C:\\ Users \\ abc> adb connect 10.0.0.1:7612 

已连接至10.0.0.1:7612

如果收到消息错误:找不到设备,则将USB设备连接到系统,然后执行相同的步骤。 对于有根设备

setprop service.adb.tcp.port 5555
stop adbd
start adbd

#5楼

假设您将adb路径保存到Windows环境路径中

  1. 在Android中激活调试模式

  2. 通过USB连接到PC

  3. 打开命令提示符类型: adb tcpip 5555

  4. 断开平板电脑或智能手机与PC的连接

  5. 打开命令提示符类型: adb connect IPADDRESS (IPADDRESS是平板电脑或智能手机的DHCP / IP地址,您可以通过Wi-Fi->当前连接的网络找到该地址)

现在在命令提示符下,您应该看到如下结果:连接到xxx.xxx.xxx.xxx:5555

posted @ 2020-07-31 20:01  Adam_101  阅读(246)  评论(0)    收藏  举报