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 ;)
精彩评论