开发者

android emulator and local site

开发者 https://www.devze.com 2023-01-06 21:34 出处:网络
I\'ve started android emulator app and trying to open from embeded browser locally started web-site, but lo开发者_运维技巧cal dns name (from /etc/hosts) is not resolved. Is there any option to enable

I've started android emulator app and trying to open from embeded browser locally started web-site, but lo开发者_运维技巧cal dns name (from /etc/hosts) is not resolved. Is there any option to enable local resolving?


Refer this URL. The issue is 127.0.0.1 is not the correct IP for accessing local server sites on emulator.

http://localhost:8080/MyTestPage.html // URL to use in computer browser
http://10.0.2.2:8080/MyTestPage.html  // URL to use in emulator browser

However, you need to do some configuration changes as suggested in the URL.


Here's how to access a locally hosted website in the Android emulator.

  1. Use IIS/Apache to host the application.
    For some obscure reason, Android Virtual Device would not let you connect to the development server created by Visual Studio.

  2. Once you host the application, use your IP address as the web address to connect to the local website. "localhost" just won't work with the AVD. Just go to the command prompt and type ipconfig to get your local ip address. You should be looking for IPv4 Address

Here's Android AVD connecting to Apache (XAMPP)

android emulator and local site

Here's connecting to IIS

android emulator and local site

Good Luck everyone and happy testing!!


You should specify your local ip address in browser, something like 192.168.xx.xx

0

精彩评论

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