While working on a bug in one of my projects recently, I found an issue that I could only recreate on an Android device. However, due to some cross-origin resource sharing (CORS) issues on my server, I had to serve my development environment from a changed hostfile that had a specific subdomain of my project.
- Android is the most widely used open-source mobile operating system in the World, with more than 1 billion activated Android devices around the globe — the need for experimentation, as much as security, is at an all-time high, and we can only expect these numbers to rise higher as Google itself prepares the rest of the World for better internet connectivity.
- OS X Yosemite Simulator remix by ellistomas. Mac OS X Sierra (10.12.0) by -Apple-Inc. Mac OS X 10.7 by PigVenomPV. OS X Yosemite X Kirby Simulator by honnybean. Mac OS Simulator by ownh. OS X Yosemite Simulator remix by ZAWSZEANONIM. OS X El Capitan Simulator 2 by Jethrochannz. OS X Yosemite Simulator by tycoonjoe.
- XePlayer is a best and free Android Emulator for pc that enables all Android games and apps to run smoothly in Windows systems.
- Best Android Emulator For Mac. ARChon is a little different than most of our best Android emulators for PC or Mac in that this one is actually a Google Chrome extension.
Here are some of the best Android emulators for Mac. Bluestacks is one of the most popular Android emulators for Windows and is probably the best Android emulator for macOS, as well. This emulator is built primarily for mobile gamers and claims to provide a “PC-like” gaming experience for your mobile apps.
With the ability to use a remote Chrome debugger from your desktop to a mobile device, you can use an emulator and still have your full Chrome debugging capabilities. The only problem then, is how to get the host file to match your desktop environment. Following these steps will allow you to do just that!
Pre-Requisites
In order to do this, you’ll need to install a few things first:
During installation, it will ask you if you want to setup an emulator. You’ll want to install all of the related Intel Virtualization packages, as it will greatly increase your speed of the emulator.
- Download and install the android-platform-tools. This will include
adb
command directly on your path for you to utilize- For macOS, I suggest using the Homebrew package manager and running
brew cask install android-platform-tools
- For Windows, I suggest using the Chocolatey package manager and running
choco install adb
- For Linux, you’ll want to check with your package manager for one of the two above-mentioned package names
- For macOS, I suggest using the Homebrew package manager and running
Setup Steps
Once you have Android Studio installed, we’ll need to setup an emulator. To do so, open the application:
Then, press “Configure” in the bottom right corner. Then press the “AVD Manager” in the sub-menu.
You’ll see a popup window that will show you the list of virtual devices. These are devices that will be used in order to run an emulator. You may already have a virtual device setup from the initial setup of Android Studio. They include the version of the operating system you use when you boot up the device. While the virtual device that was setup out-of-the-box is fine for most operations, we’ll want to setup an older version of the emulator. This will allow us to change the host file in Android, which requires root (something the default images won’t allow).
Select Create Virtual Device, then select a device type. In my example, I selected Nexus 5, but any device definition of a relatively modern phone should work.
As mentioned before, the default images that are provided will not allow us to replace the host files. In order to do so, we have to download an older Android image (and one that does not include Google Play Store). To do this, I selected the x86_64 Android 7.1.1 (non Google API version) image to download and then selected Next.
It’s worth noting that we specifically must select a non-Google version, otherwise our future commands will not work (per Google’s restrictions on Google API images).
After this step, proceed to name the Android Device. I’d suggest you name it something without any spaces in order to run a command later that you’ll need to run. In this case, I called the image Nexus5.
Handling the Emulator
Once the AVD is initially setup, open your terminal, and find your installation path of Android Studio.
- For MacOS, this should be under ~/Library/Android/sdk
- For Windows, this should be C:Users<username>AppDataLocalAndroidsdk
Once in that path, you want to run a specific emulator command:
For example, given that I’m on macOS and my AVD name is Nexus5, I ran:
This will start the emulator under specific pretenses. These pretenses will allow you to write to any file on your OS, including the host file.
Once you’re done with running the emulator, open a new tab and run the following commands (in a folder you want to have the host file within):
adb root
adb remount
adb pull /system/etc/hosts
Upon running these commands, you’ll find a hosts file. This file is the file that tells your OS what path a given domain has. You can, for example, map example.com
to go to a specific IP address, similar to how DNS works for most domains.
Inside the emulator, the IP address 10.0.2.2
refers to the host OS. For example, if you’re running a local server on your Windows/MacOS/Linux machine on localhost:3000
, you can access it using 10.0.2.2:3000
from the Android emulator.
Knowing these two things, you can change the host file to make example.com
refer to the host by adding the following to the host file:
Pushing the Changes
Once you’ve made the changes to the host file that you want to have changed, you’ll have to push the host file to the OS of the AVD:
adb push ./hosts /etc/hosts
adb push ./hosts /etc/system/hosts
adb push ./hosts /system/etc/hosts
While only one of these host file locations is needed to replaced, it’s easier to run all three than only run one to see if it worked
In order for the changes to the host file to take effect, you’ll have to restart the emulator. In order to do so, you’ll want to press and hold the power button off to the right of the emulator. Then, press “Restart”.
If you close the emulator and re-open it using the command above, it may work, but I’ve found instances where it seems to reset the host file, making you go through the whole process again
Seeing the Results
Finally, you’re able to sideload the Chrome APK’s x86 variant in order to load the example codebase.
So, for example, using the above hostfile as an example, we can visit example.com:8000
when running the development mode for the project’s GitHub code, you’re able to see a preview of the Unicorn Utterances website from a different domain.
And that’s it! You now know how to modify and update the host file for an emulated Android device. I hope this has helped with your development usage!
Corbin Crutchley
Corbin Crutchley is a fan of anything tech related. Always looking for new ways to learn and grow, he spends most days tinkering on a machine of some kind. He has experience with Python, Angular, React, and NativeScript. Corbin cares passionately about documentation and always wants to contribute back.
Are you want to run your favourite Android apps, on your Windows and Mac OS?
We all know that have, Android Emulator has launched for Windows; We had a long wait for this software Because if anybody wanted to run any favourite android app on PC, it had not possible at that time. But we always thought in our mind, “Why will not happened.” Yes for running any Android app we had a need to format our PC with Android OS then it’s happened. So without wasting any more time, Let’s move to our topic. In Today’s post, I will share one of the fasted android emulator for PC – Windows 7/8/8.1/10 or Mac
Since the Android emulator has arrived, our work has become even easier, and we have not need to format your PC again and again with Android OS or with Windows 7/8/8.1/10 or MAC OS. And now we can freely enjoy any of Android’s application on PCs with freedom. In my the earlier post, I had shared how to run android apps on google chrome
Here are some related articles for you to read next:
Jump to: Android Emulator for PC | Nox App Player | AmiDuOS | Remix OS Player | Bluestack
Fastest Android Emulator for PC – Windows 10/8/7/Vista/XP and Mac
Here we have listed the fastest android emulator for PC below:
1. Nox App Player Emulator
Nox App Player is the best Fastest & smoothest Android Emulator for PC. It easy to utilize any Android app on the emulator. It comes with the best performance and high graphics and easy to control any games & apps with all compatibility Processors as AMD or Intel processor with a dual-core and more existing processor. I also tried on my PC. It works fine and the best emulator ever.
Features of Nox App Emulator
1. Design for Android 4.4.2 kernel
2. Compatible to run on Windows 10/8/7/Vista/XP and Mac
3. Smooth & Fastest to Run any Google Play App
4. Import any Android Application or Drag and drop to install any android application
5. Adjust CPU, RAM, and Resolution
6. Control, game via gamepad and controller or keyboard, etc.
2. AmiDuOS
AmiDuOS is the easy & Fast emulator for PC. AMIDuOS supports 3D acceleration for enjoying the gaming & more Android Apps. AmiDuOS Developed with Lollipop/Jellybean version and runs nearly all Android app available on Google Play Store. It works on nearly any Windows 7,8 or 10 PC or Windows tablet or MAC. It also helps to Save the Battery Power while running the emulator.
Features of AmiDuOS Emulator
1. Supported for Android 4.4.2 kernel
2. Compatible with Windows 7,8 or 10 PC or Windows tablet or MAC
3. Integrate with Google Play App
4. Full Resolution
5. Save power and extend Battery life etc.
3. Remix OS Player
Remix OS Player is one of the most and popular Android Emulator for PC. From the Remix OX Emulator allow you to run multiple Android Games & Apps at the same time on your PC. Remix OS Player is based on Android Marshmallow. The main cons are that Remix OS doesn’t work with AMD processors. Overall, this is the best for enjoying your favourite Android games on a PC with Remix OS Player.
Features of Remix OS Player
1. Easy to use
2. Compatible with Windows 7,8 or 10 PC newer
3. Supported Google Play App
4. Utilizes with the latest Android Studio technology
5. Multi-game like a boss with High Resolution etc.
4. Bluestack
Mac Os Android Simulator Online
BlueStack is very popular Android Emulator for PC. It allows for the multitasking for full enjoyment with the Android Games and Apps. It comes with the most graphics experiences to run smoothly. BlueStacks Available for the Windows & Mac & Supported with Intel, Samsung, Qualcomm and AMD Processor.
Features of BlueStacks
1. Full enjoyment with Multitasking
2. Compatible with Windows 10/8/7/Vista/XP and Mac
3. Installed Google Play App
4. One Click to Start
5. Watch Live stream on Twitch.tv etc.