androidandroid-emulatorlocalhost

Android: "Bad Request-Invalid Hostname" When accessing localhost from emulators


I am not able to use localhost with xamarin.android application. I have executed Web project & Service project(not mobile app) on Chrome Browser.

This is emulators executed project

The displayed port number I tried browsing in Android Studio emulators & Genymotion emulators by appending 10.0.2.2: & 10.0.3.2: respectively, I got result Bad Request-Invalid Hostname. Even I have tried Service project port number, both not working.

Web Project: ASP.NET project using Visual Studio 2017 & Having service project in the same solution.


Solution

  • I have answered this on another stackoverflow question, using third party software ngrock

    Check this Android emulator not connecting to localhost api