Search code examples
androidiismobilegenymotionparallels

Android Emulator from Mac to Parallels with Web API on Local IIS


I am developing a React Native mobile app in a Mac environment for both iOS and Android devices (iOS is running perfect as usual). I have Android Studio installed with all the necessary dependencies from the SDK Manager, and the project builds and starts up successfully on both Android emulator and iOS simulator.

Here's where the problem kind of starts. I also have Parallels installed running Windows 10 with Visual Studio 2015 (Shared Network setting in Parallels), which runs my Web API project on Local IIS. The goal is to have these devices make requests to the Web API project in the Parallels environment (Again, iOS is good, Android is the problem).

On the Windows machine, I have modified the hosts file to include

127.0.0.1   <IISHostName>

On Mac, I have modified the hosts file to include

<MyWindowsIPAddress>   <IISHostName>

On Mac, I am able to hit the Windows dev environment using a REST client and from the iOS simulator. However, the Android emulator (Genymotion) does not. It comes back with an error "Network Request Failed".

I am guessing that in the "Dev Settings"->"Debug server host & port for device", there is an address that needs to be set in order for the emulator to communicate locally with the Mac, which will then communicate with Parallels, but I'm not sure. Any suggestions?

*Note: Most articles I've read give instructions for the Windows environment to be able to see an emulator on Mac, I would like it the other way around (Emulator on Mac -> Windows).


Solution

  • This can be done as follows:

    • From a windows command prompt, run ipconfig and snag your IP:

      IPv4 Address. . . . . . . . . . . : 10.211.55.4

    • Next, modify your .vs\config\applicationHost.config to bind to all interfaces:

      binding protocol="http" bindingInformation=":8080:" />

    • Restart your web api project

    Navigate to http://10.211.55.4:8080/... from your android emulator's browser to confirm.