如何在Android启动时使adbd侦听端口? [英] How to enable adbd to listen to a port at boot time in Android?

查看:920
本文介绍了如何在Android启动时使adbd侦听端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个扎根的HTC Hero,我想做的就是让adbd
在启动时监听端口。

I have a rooted HTC Hero, and what I want to do is to enable the adbd to listen to a port at boot time.

I尝试在此处找到的代码:

I tried some code found here:

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

在Android shell中运行,效果很好。

in an Android shell and it works great.

我尝试更改 init.rc 文件。我将上述代码添加到init.rc
中,并通过以下命令将其替换为原始文件:

I tried to change the init.rc file. I added the above code in init.rc and I replaced it with the original file, through these commands:

adb push init.rc sdcard

adb shell
adb su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /
adb cp sdcard/init.rc /

文件已成功替换,但是当我重新启动手机并尝试连接
通过:

The file is replaced successfully, but when I reboot my phone and try to connect through:

adb connect <IP>:5555

未建立连接。

有什么想法吗?

(PS。我不想使用 remoteADB 应用程序和shell命令,例如
am start -n ...

(PS. I don't want to use the remoteADB application and a shell command like am start -n ... )

推荐答案

这将使其持久:

setprop persist.adb.tcp.port 5555

ADB 通过USB 重新启动后可能不可用。要撤消此设置,请执行以下操作:

ADB over USB might not be available after reboot. To undo this setting, do:

setprop persist.adb.tcp.port ""

这篇关于如何在Android启动时使adbd侦听端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆