简体   繁体   English

Genymotion android模拟器adb shell无法编写/ etc / hosts

[英]Genymotion android emulator adb shell can't write /etc/hosts

I have some virtual hosts under my localhost and I need to add it to /etc/hosts in Genmotion android emulator. 我的本地主机下有一些虚拟主机,我需要将其添加到Genmotion android仿真器的/ etc / hosts中。

for that I used in windows cmd: 对于我在Windows cmd中使用的:

adb shell
mount -o remount,rw /system
echo "192.168.xxx.xxx   my_virtualhost" > /etc/hosts

I have tried that to this virtual device: Google Galaxy Nexus - 4.2.2 - API 17 - 720x1280 and all ok. 我已经尝试过使用以下虚拟设备: Google Galaxy Nexus-4.2.2-API 17-720x1280 ,一切正常。 I got root shell and my_virtualhost is added to /etc/hosts 我得到了root shell,并将my_virtualhost添加到了/ etc / hosts

But when I tried to do same on other virtual device: Google Nexus 9 - 7.1.0 - API 25 - 1536x2048 Don't work and I got this: 但是,当我尝试在其他虚拟设备上执行相同操作时: Google Nexus 9-7.1.0-API 25-1536x2048无法正常工作,我得到了以下信息:

adb shell
mount -o remount,rw /system
echo "192.168.xxx.xxx   my_virtualhost" > /etc/hosts > /etc/hostsvbox86p:/ # mount -o remount,rw /system
mount: '/dev/block/sda6'->'/system': Device or resource busy
1|vbox86p:/ # echo "192.168.xxx.xxx   my_virtualhost" > /etc/hosts

Any idea how to solve this or another way to edit /etc/host ? 任何想法如何解决此问题或另一种编辑/ etc / host的方法吗?

I had the same problem on my OnePlus 5. 我的OnePlus 5遇到了同样的问题。

Had to upload modified hosts file to /sdcard and then copy it to /etc/hosts via Root Explorer app which handled rw remount properly on the fly. 必须将修改后的hosts文件上传到/sdcard ,然后通过Root Explorer应用程序将其复制到/etc/hosts ,该应用程序可以实时处理rw重新安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM