views:

32

answers:

1

When I run this code from Java project it works fine.

InetAddress ia=null;
    try {
        ia = InetAddress.getByName("www.google.com");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }
    System.out.println(ia.getHostAddress());

When i try the same code from emulator (already tried few versions) I'm getting UnknownHostException. Internet works fine on emulator and I'm able to connect to IP address like "93.86.230.251" but never to hostname "something.org".

Please help

A: 

load a web page in the browser of your emulator if you can't load any page probably you´ll need a proxy configuration

http://developer.android.com/intl/fr/guide/developing/tools/emulator.html#proxy

Jorgesys