如何从Android模拟器文件系统中删除ReadOnly状态? [英] How to remove ReadOnly status from android emulator file system?

查看:327
本文介绍了如何从Android模拟器文件系统中删除ReadOnly状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编辑我的Android模拟器(AVD)主机文件,因此它可以访问我在Mac OS主机中拥有的虚拟主机.

I`m trying to edit my android emulator (AVD) hosts file, so it can acess a virtual host i have in my Mac OS host machine.

我尝试按照此链接上的说明进行操作: http://borkweb.com/story/setting-etchosts-on-an-android-emulator-using-a-mac

I try following the instructions on this link: http://borkweb.com/story/setting-etchosts-on-an-android-emulator-using-a-mac

但是我一直收到仅适用于Read的文件系统"消息.我已经使用Android Studio的Android Device Monitor进行了尝试,但它也为ReadOnly.

But i keep receiving "REad Only File System" messages. I`ve tried it using Android Device Monitor, from Android Studio, but it also ReadOnly.

如何从模拟器文件系统中删除ReadOnly状态?

How can I remove the ReadOnly status from my emulator file system?

推荐答案

要在模拟器中更新主机文件,请将以下脚本与更新的主机"文件保存在同一目录中:

To update the hosts file in the emulator, save the following script in the same directory as your updated "hosts" file:

#!/bin/bash
#
# While the emulator is starting up, run this script to upload a custom hosts file
#
adb remount
while [ $? -ne 0 ]
do
 sleep 1
 echo "Retrying adb remount"
 adb remount
done
adb push hosts /etc/hosts
if [ $? -ne 0 ]
then
 echo "Failed to push hosts file to android device"
else
 echo "Hosts file pushed successfully"
fi
############################################################################

在模拟器启动时运行此脚本.

Run this script when the emulator is starting up.

验证:adb shell cat /etc/hosts

请注意:您只能运行一次!如果您多次运行它,将会收到一个只读文件系统错误.如果必须再次运行它:请事先重新启动仿真器.

Please note: you can it only run once! If you re-run it more than once, you'll get a read-only filesystem error. If you have to re-run it again: restart the emulator beforehand.

对我的同事.

这篇关于如何从Android模拟器文件系统中删除ReadOnly状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆