简体   繁体   中英

How to remove ReadOnly status from android emulator file system?

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.

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

But i keep receiving "REad Only File System" messages. I`ve tried it using Android Device Monitor, from Android Studio, but it also 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.

Verification: 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.

Kudos to my colleague .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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