I had a lot of fights with this and I think it’s better to write down the solution so I won’t waste my time looking again on google/stackoverflow for it. Maybe this will help you too!
You might have a local webservice or something on your machine that needs to be accessed from a Genymotion emulator. At first you would point to localhost or 127.0.0.1 and you will note that you get “Web page not available” or whatever your browser tells you when it doesn’t find a page for you..
Then you will search over the internet and you will find that in order to point to localhost from the pc that hosts the Android emulator you have to use 10.0.2.2 instead. Great! You try that then but 🙁 you will see that it fails (at least on Mac OS).
That will route you to localhost (127.0.0.1). Please note that if your localhost server/page needs a special port, don’t forget to add it at the end of the ip address :)!
Hope this helps!
Search In Blog
Want to donate?
Recent Posts: My Android Solutions
If you ever wondered how to read and parse a simple JSON file stored in the assets directory of your Android project, here is a way to do it.
In this tutorial I will create a simple Sectioned RecyclerView that will show 2 sections and a few items in each section and how to move an item from one section to another. Note: For RecyclerView I used AndroidX imports and not android.support.v7.widget.RecyclerView! Setup We need to import the recycler view from AndroidX. The build.gradle…
Recently, I had to add a perfect square CardView and I wanted to achieve this without hardcoding its width and height. I happily discovered the power of ConstraintLayout and this is how I managed to create a perfect square which should work on every dimension. In my project I created a RecyclerView with 2 columns,…