以修改hosts文件为例:

由于某些原因,可能需要指定域名对应的IP地址。Android是基于Linux的系统,与Linux类似,通过hosts文件来设置。

在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 <PC机上文件名>

4、修改PC机上文件

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

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

更多相关文章

  1. CrossWalk - Android 动态加载so库文件
  2. Unexpected namespace prefix "xmlns" found for tag LinearLayo
  3. Android下使用TinyXml读取xml配置文件(Cocos2d-x游戏开发)
  4. Android创建文件夹
  5. android 数据库技术 | 文件系统,SDCARD访问,CONTENT PROVIDER,SQLIT
  6. Android studio 使用心得(六)---android studio 如何加载.so文件

随机推荐

  1. android 中文 api (71) ―― BluetoothServ
  2. React native Android(安卓)命令 打包apk
  3. 51. (android开发)线性布局、相对布局、
  4. Android札记
  5. 关于“Only the original thread that cr
  6. Android换肤机制
  7. Android点击事件的四种写法
  8. Android编程: 环境搭建、基本知识
  9. 杂七杂八2
  10. Android去除标题栏及自定义title栏