Web development testing in Android Virtual Device
Some time, we will need to test web development in mobile devices.
Previously, I used to test in iOS simulator, the virtual host will just work.
E.g. http://myproject.test, by inputing this URL to simulator Safari, will just work fine.
Recently I tried to install AVD, unfortunately, the device (simulator) just don’t know about myproject.test
.
In this case, need to edit the hosts file
First, find out which device you want to use
1 | $ /path/to/android/sdk/platform-tools/adb devices |
Set the emulator to writable (nexus_5
here is the device name)
Choose x86 Images, then choose Android 7.1.1 (non Google APIs) (see reference below for more details)
1 | $ /path/to/android/sdk/tools/emulator -writable-system -netdelay none -netspeed full -avd nexus_5 |
Open browser in android device, type in the URL http://myproject.test