简体   繁体   English

无法更改Android虚拟设备上的主机文件

[英]Unable to Change hosts file on Android Virtual Device

I'm using Android Studio 2.1.2 on Mac OSX (El Capitan). 我在Mac OSX(El Capitan)上使用Android Studio 2.1.2。 I created an Android Virtual Device (Nexus 5, API 19) through the AVD Manager. 我通过AVD Manager创建了一个Android虚拟设备(Nexus 5,API 19)。 I want this device to interact with my local apache server, as I test my new Android app. 当我测试我的新Android应用时,我希望此设备与我的本地apache服务器进行交互。 However, when I try to update the hosts file on the emulator, I keep getting "mount: Read-only file system" error, as I follow the instructions found in questions like this: How to change the hosts file on android and https://android.stackexchange.com/questions/60446/cant-remount-system-in-rw 但是,当我尝试更新模拟器上的hosts文件时,我不断收到“mount:只读文件系统”错误,因为我按照以下问题中的说明操作: 如何更改androidhttps 上的hosts文件 : //android.stackexchange.com/questions/60446/cant-remount-system-in-rw

I have tried all the suggestions given, but unable to push the hosts file to the emulator. 我已经尝试了所有给出的建议,但无法将hosts文件推送到模拟器。

Has anyone ran into this and solved lately? 有没有人碰到这个并最近解决了? If yes, kindly let me know how to address this. 如果是,请告诉我如何解决这个问题。 Thanks in advance. 提前致谢。

I've faced the same problem.To access hosts file in mobile/emulator it needs to be rooted. 我遇到了同样的问题。要在移动设备/模拟器中访问主机文件,需要植根。

So try using Genymotion emulator for android Mac which comes rooted by default. 所以尝试使用Genymotion模拟器为Android Mac默认生根。 you can find genymotion for mac here : Genymotion for Mac 你可以在这里找到genymotion for mac: Genymotion for Mac

To access your host files follow : Modify hosts file in emulator 要访问主机文件,请执行以下操作: 在模拟器中修改主机文件

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

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