android – WebView and localhost-ThrowExceptions

Exception or error:

I am getting inside my WebView, but am not getting my localhost in that.
Can anybody help me?

How to solve:

Use instead. This is a special ip address that the emulator routs to local host on your dev machine. assuming that emulator and the webserver are running on the same machine.


Make sure you are loading WebView with full Urls.

and not:

All of these will work while using Browser, but you must supply a full valid url for WebView. Banged my head against the keyboard for an hour figuring that out.

If you’re having connectivity issues in the emulator, try overriding the dns in the build path.

Window > Preferences > Android > Launch
Default emulator options: -dns-server


I have created a website and published it in my local computer using IIS, I tried to access this site in the android emulator using WebView:


with the same results as the OP.

I changed to:

and worked.


Just type localhost name and port like this:


Try your actual ip [with the port number if required] instead of localhost.

Leave a Reply

Your email address will not be published. Required fields are marked *