Weeks ago, when I was working on Android project, I noticed something unusual on my macOS machine. I couldn’t start my Android emulator. Every time I built the app, it just never showed up.

I rarely use real phone to test my app since Google now provides best Android emulator experience. So that’s why I always use Android emulator as first solution to test my app. So this kind of problem really made me down.

So I was thinking what could be possibly wrong with my Android emulator? I tried to close my other apps to see if some of it were conflicting with my emulator. Then I realized when I stopped and closed Docker for Mac, it worked again!

That actually made sense because both of them are using virtualization system on my machine to work. I didn’t understand it under the hood how it couldn’t work together. I didn’t really care why, as long as I could use my emulator by stopping Docker that would be enough. Until I realize I need to use both of them at the same time.

It was frustrating experience knowing that you couldn’t use Docker and Android emulator at the same time. I was googling “Docker Android emulator macOS fix” but had no luck, until a couple days ago.

I arrived at the moby github issue page and found someone posted that Intel HAXM version 6.1.1 fixed this issue! I was happy, finally I can use my Android emulator and Docker at the same time on my macOS machine.

First thing to do is to check what Intel HAXM version our emulator used. This can be done by typing this on your terminal:

$ ~/Library/Android/sdk/tools/emulator -accel-check

You can also double check with this command:

$ kextstat | grep intel

Mine was detected as version 6.0.5. To make my machine clean, I uninstalled the current installed version. This can be done by typing this command:

$ sudo /Library/Extensions/intelhaxm.kext/Contents/Resources/uninstall.sh

Now that current Intel HAXM is removed, you can fresh install the latest version of it. Open your Android SDK Manager and download the latest Intel HAXM available. After it’s downloaded, we’re not done yet. Open your Android SDK directory and head to extras/intel/Hardware_Accelerated_Execution_Manager/ directory. Open IntelHAXM_6.1.1.dmg file and follow installation instruction.

Check again installed Intel HAXM version used by emulator by typing previous commands. If it’s version 6.1.1 or newer, that would be great. That means you can use Docker and Android emulator together in harmony on your macOS machine.

Hope this simple tutorial solves your problem. Happy Coding!

References