Check device name (ideally it would be to have a short name without spaces, eg.
Make sure you have in path emulator and toolsĮxport ANDROID_HOME="/Users/YOUR_USERNAME/Library/Android/sdk"Įxport PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$PATHĮDIT: For Windows should something like this (instead of tools required platform-tools ) C:\Users\YOUR_USERNAME\AppData\Local\Android\sdk\platform-toolsĬ:\Users\YOUR_USERNAME\AppData\Local\Android\sdk\emulator.You will see the contents of hosts file in the Terminal:Īnother approach to this matter would be to use the adb command line tool. To verify that the hosts file has been pushed you can run the following commands: system/etc/ is the location in Android's emulator where we want to copy that file.Īfter successfull operation you will see a message like this: Now is the time to push our host file from Windows machine to Android's emulator adb push D:\hosts /system/etc/ĭ:\hosts is the location of the hosts file present at the D drive of my Windows machine. You will get a remount succeeded message after that: When the emulator is rebooted, run the following commands: In a new Terminal tab run the following commands: Replace Pixel_XL_API_29 with your AVD name. Run the following command to open the emulator for writable mode: emulator -avd Pixel_XL_API_29 -writable-system -no-snapshot-load Run the following command to know your AVDs: emulator -list-avds I hope this helps someone as i spet quite some time trying to figure this out.īelow are the steps I followed on my Windows machine on Windows Terminal: Just to be complete here is how my hosts file looked like I was then able to connect to my virtual hosts from the emulated device
adb shell and then cat /system/etc/hosts You can veryfy the copy was successfull by. adb -s emulator-5554 push ~/Desktop/hosts /system/etc/hosts 'emulator-5554' is the name of my device which you can find by typing. String together a bunch of commands to copy the file quickly.Prepare the hosts file you want to copy to your device (in my case i put it on desktop).In your terminal find the folder "platform-tools" for your devices.After reading a bunch of different instruction nothing seemd to work for me untill someone mentioned that you have a very narrow window for copying the file from your disk to the emulated device or it becomes read-only again Here is how i was able to do it working on OSX. Root and Remount the AVD like the followings... C:\Users\ilyas.mamun\AppData\Local\Android\Sdk\platform-tools>adb rootĬ:\Users\ilyas.mamun\AppData\Local\Android\Sdk\platform-tools>adb remountĬ:\Users\ilyas.mamun\AppData\Local\Android\Sdk\platform-tools>adb shell Qemu-system-i386.exe: warning: opening audio input failed HAX is working and emulator runs in fast virt mode.Īudio: Failed to create voice `goldfish_audio_in' Start the emulator with the following command... emulator.exe –avd -writable-systemįor example: C:\Users\ilyas.mamun\AppData\Local\Android\Sdk\emulator>emulator.exe -avd Pixel_API_25 -writable-systemĮmulator: WARNING: System image is writable Use for example Google APIs Intel x86 Atom System Image.Don’t Create the AVD with a Google Play image.