简体   繁体   中英

Android Internet not work in emulator?

I am developing an android application which is using web api service. but my emulator can not access internet connection.

  1. i am using this bundle- adt-bundle-windows-x86-20131030
  2. IDE- Eclips
  3. internet connection - LAN

Make sure to define this in your manifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.app.myapp" >
    <uses-permission android:name="android.permission.INTERNET" />
    ...
</manifest>

In my case i have an internet permission in AndroidManifest.xml, but anyway the internet did not work. The deal was in the dns server. It helped me:

1. Check environment emulator path and make sure it is like this:
MacOS:
~/Library/Android/sdk/emulator
Windows:
C:\Users\%Username%\AppData\Local\Android\sdk\emulator
2.Check your available emulators list:
emulator -list-avds
3.Run your available emulator with dns server set to 8.8.8.8:
emulator @{YourEmulator} -dns-server 8.8.8.8
And after you can get access to Google from your android emulator.

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