阅读 109

安卓模拟器修改host

实现效果

查看设备

emulator -list-avds

output:
Nexus_5X_API_24
Pixel_2_API_26
复制代码

启动设备

emulator -avd Pixel_2_API_26 -writable-system

output:
emulator -avd Pixel_2_API_26 -writable-system
emulator: WARNING: System image is writable
emulator: INFO: boot completed
复制代码

执行权限

adb disable-verity # 如果权限不行再执行这个
➜   adb root root
restarting adbd as root
➜   adb remount
remount succeeded

复制代码

修改host

# 将hosts文件放在指定文件夹下(本文中放在桌面)
adb pull /system/etc/hosts ~/Desktop/hosts 


➜   adb push ~/Desktop/hosts /system/etc/hosts
/Users/gaopo/Desktop/hosts: 1 file ...hed. 0.0 MB/s (118 bytes in 0.008s)
复制代码

~/Desktop/hosts 文件内容