在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。

 

 
 

相关文章:

  • 2022-02-01
  • 2021-12-07
  • 2022-02-05
  • 2022-02-14
  • 2022-02-11
  • 2021-09-20
  • 2021-06-07
  • 2022-01-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2021-08-18
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
相关资源
相似解决方案