host修改

来源:互联网 发布:武汉大学网络教育课程 编辑:程序博客网 时间:2024/05/01 12:22

在Android下,/etc是link到/system/etc的,我们需要修改/system/etc/hosts来实现。但是这个文件是只读,不能通过shell直接修改。可以通过连接到PC上使用adb来修改。

1、获得root权限:adb root

2、设置/system为可读写:adb remount

3、将hosts文件复制到PC:adb pull /system/etc/hosts hosts

4、修改PC机上文件

5、将PC机上文件复制到手机:adb push hosts /system/etc/hosts

至此,对hosts的修改就成功了。无需重启哦~!~

如果要查看是否修改成功,可以在PC上执行adb shell,运行cat /system/etc/hosts;或者在手机的终端模拟器上运行cat /system/etc/hosts。

0 0
原创粉丝点击