手机改host

2018-08-07  本文已影响0人  海是倒过来的天_67f2

如果测试环境的话需要指定host

在安全中心里打开root权限,需要下载和重启。

设置磁盘可读写:

adb root

adb remount

?

然后adb shell,在手机的shell里操作/etc/hosts。

用adb pull和push也可以编辑/etc/hosts,但是比较麻烦,容易出错。

?

查看/etc/hosts:

cat /etc/hosts

?

新增一条记录:

echo 10.235.145.31 hot.browser.miui.com >> /etc/hosts

?

删除第n行,以第2行为例:

busybox sed -i '2d' /etc/hosts

?

搜索hot并删除该行:

busybox sed -i '/hot/d' /etc/hosts

运营环境搭建

手机上打开开发者模式,debug,root权限

adb root

adb remount

adb shell

ls

cd /etc/

cat hosts

exit

adb remount

C:\Users\fsl>adb pull /etc/hosts d:\hosts

C:\Users\fsl>d:

D:\>dir

D:\>adb push d:\hosts /etc/hosts

adb shell

leo:/ # cat /etc/hosts

如果不成功的话

adb disable-verity

adb reboot

安装apk

上一篇 下一篇

猜你喜欢

热点阅读