Testing local running websites on Android Emulator, in OS X environment
Published on 20 October 2010
In order to test local websites on Android Emulator you need to first install the SDK:
$: brew install android
Then, in order to start android-sdk type:
If that throws an error, like the following:
emulator: ERROR: could not find required kernel image (kernel-qemu). emulator: Maybe defining ANDROID_SDK_ROOT to point to a valid SDK installation path might help ?
you can add the following (the example is for default brew installation) in your
# this is required for android SDK to start from terminal export ANDROID_SDK_ROOT="/usr/local/Cellar/android-sdk/r6/"
If you haven't installed the emulator via brew, find out where SDK is placed and assign ANDROIDSDKROOT that path.
In the application menu include repository and update packages.
Create an instance of emulator and remember its name (say, "test").
When starting your emulator you will have to use the -partition-size command to avoid out-of-memory messages.
$ emulator -avd [your-emulator-name] -partition-size 128
After emulator has started, in other terminal instance (tab or window), type:
$ adb remount
This will prevent "read-only file system" problem.
Then, to enter virtual device's shell:
$ adb -e shell
and within the shell do (replace %YOURLOCALHOST% with your desired host):
# echo '10.0.2.2 %YOUR_LOCAL_HOST%' >> /etc/hosts
"10.0.2.2" is your hosting machine’s IP, – so %YOURLOCALHOST% will be pointing at your master machine, where web server is running.
Now you can go to the browser on your android emulator and access your locally running development server with desired development domain.