我无法编辑android模拟器的主机文件 [英] I can't edit android emulator's host file
问题描述
我尝试编辑android模拟器的主机文件.请按以下步骤操作:
I try to edit android emulator's host file.I follow steps:
step1
adb root
step2
adb remount
step3
adb pull /system/etc/hosts .
然后添加新行以获取客户主机信息,然后推送主机文件,出现一些错误:
then I add new line for customer host information,then I push hosts file,I get some errors:
step4
adb push hosts /system/etc/hosts
错误信息:
adb: error: failed to copy 'hosts' to '/system/etc/hosts': couldn't create file: Read-only file system
环境信息:
osx ei capitan
android emulator: android 7.1.1
android studio: 2.2.2
推荐答案
我只是遇到了同样的问题并使它起作用.
I just ran into the same problem and made it work.
运行模拟器:
emulator -avd< EMULATORNAME>-partition-size 512-可写系统
我相信 -writable-system
参数是为我修复的东西.
I believe that -writable-system
param is the thing that fixed it for me.
在另一个终端/cmd提示符下:
adb根
adb -s emulator-5554重新安装
adb -s emulator-5554 pull/system/etc/hosts主机
现在,发挥您的魔力(将IP添加到主机文件)
Now, work your magic (add the IP to host file)
adb -s emulator-5554推送主机/system/etc/hosts
其他信息:
- emulator-5554是设备名称,您可以使用
adb设备
查找自己的设备名称 - 模拟器程序位于android-sdk/tools内部
- adb程序位于android-sdk/platform-tools
评论的重要更新:
在运行 adb root
之前,请检查从steven到此帖子有关运行 adb重新启动
的评论.这对于能够从AVD管理器启动仿真器可能很重要.
Please check the comment from steven to this post about running adb reboot
before running adb root
.
This might be important to being able to start the emulator from AVD manager.
队长建议在推送主机文件后运行 adb重新启动
,以避免出现黑屏错误.
Captain suggests to run adb reboot
after pushing the host file to avoid blackscreen error.
调试愉快:)
这篇关于我无法编辑android模拟器的主机文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!