开发者

Ping host from android emulator

I am trying access web page hosted in my dev Ubuntu machine from android emulator. I am able to browse internet from emulator but web page from the host dev machine is not accessible, giving tcp_error. I am not ab开发者_JAVA技巧le to ping the host machine too. I tried using ip address of host not localhost or 127.0.0.1.

any idea?


According to Google's official document, 10.0.2.2 is a special alias to host loopback interface (i.e., 127.0.0.1 on your development machine).

So you can try to connect 10.0.2.2 as your host address to access your web pages from your host dev machine.


you have to put this line just after android:minSdkVersion tag in your AndroidManifest.xml

    <uses-permission android:name="android.permission.INTERNET" />

Hope it works ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜