简体   繁体   中英

How to config Android emulator to connect to internet

I've been struggling with how to config my Android emulator to connect to the Internet, and of course I tried a lot of solutions such as disable the LAN card or add dns server, http proxy in eclipse, etc...

Unfortunately, those solutions seem to work very well for lots of people but not for me.

Finally I found the right solution which is easy to understand, easy to do and works well.

Reason: The reason that your PC can connect to internet but your emulator can't is that emulator's default DNS server is [10.0.2.3] which is different from the real one you are currently using.

Steps: 1. 'CMD->ipconfig /all' to get real DNS server eg 192.168.1.1 2. 'CMD->adb shell->getprop' to get emulator's DNS info as following [net.dns1]:[10.0.2.3] 2. 'CMD->adb shell->setprop net.dns1 192.168.1.1' to set DNS server

note. if adb shell is not recognized as a valid command, try set ANDROID_HOME and path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM