您的位置:首页 > 移动开发 > Android开发

Using Android Debug Bridge (ADB) over Wifi

2015-08-06 14:47 435 查看
Using Android Debug Bridge (ADB) over Wifi

On the target device running Android (using the serial console):

Turn on Wifi and connect to desired network from GUI

Settings >> Wireless and network >> Wifi settings…

On the target device running Android (using the serial console from host):

stop adbd

setprop service.adb.tcp.port 6565

start adbd

On the host machine

adbconnectDEVICEIP:6565 adb connect DEVICEIP:6565
adb shell

Optional: To make property persistent on target

You can make the ‘service.adb.tcp.port’ property persistent if you want by making changes to source and rebuild.

This way you don’t have to repeat the commands in Step 2 above on target on every reboot. To do this, (Note: : Refers to android source top level directory.)

a. Copy buildspec.mk.default as buildspec.mk into android source top level directory

$ cp /build/buildspec.mk.default /buildspec.mk

b. Make the following change to the buildspec.mk

-#ADDITIONAL_BUILD_PROPERTIES +=

+ADDITIONAL_BUILD_PROPERTIES += service.adb.tcp.port=6565

c. Rebuild. (Refer to /build/core/config.mk for more info on customizing builds with buildspec.mk.)

d. To make sure the change worked, you can look at the generated /system/build.prop file you should see line

service.adb.tcp.port=6565

in that file.

Once you flash this system image into target, you should be able to skip Step 2 for successive boots. Actually you will not need to do Step 1 for every reboot as target remembers the network it connected to first time and automatically reconnects to same network. So you can just directly go to Step 3 for successive reboots.

Note: default adb port is 5555, and using another value is trivial security measure. However, adb access at all, and networked access foremostly, is utterly insecure and intended to be used only on development-only devices in a physically and networkedly controlled environment. Never enable those on a production-use device or on a device which may contain sensitive data. The same goes for unauthenticated root access.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: