533

I know that similar questions have been asked before, but my problem is new only after installing Android Studio 2.3, the latest version in March 2017. I have several years experience developing Android applications, and I have never encountered this problem before. After upgrading to version 2.3 of Android Studio, my emulator is no longer able to access the internet. I even uninstalled/reinstalled Android Studio 2.3 from scratch and created a new emulator, and I am still getting the same error. This is not an app problem. I can't even access the internet from Chrome, and I wasn't having this problem last week. The message that I get says that the server DNS address could not be found -- DNS_PROBE_FINISHED_BAD_CONFIG. The only thing that has changed on my computer in the last week is the new version of Android plus possibly updates to Windows 10. And yes, my computer has access to the internet. Below is an image of my emulator when I try to use Chrome to search for "Google". emulator with error message

John Moore
  • 7,282
  • 3
  • 14
  • 14
  • I have discovered an additional issue with Android Studio 2.3 that is not related to internet access but could somehow be related to the one above. With Android Studio open to a project and an emulator running, I can run the app on the emulator just fine. But if I open Android Device Monitor, it tells me that the emulator is offline. Then, if I close Android Device Monitor and go back to Android Studio, it also tells me that the emulator is offline. I have to close and restart the emulator before Android Studio can find it again. This problem, like the one above, is repeatable. – John Moore Mar 11 '17 at 14:12
  • Another update. I installed Android Studio 2.3 on another, older/slower Windows 10 computer, and the problem still occurs. Also, at one point I thought that the problem might be related to a bad Microsoft WPD patch, but the older computer did not have the patch installed. Plus, after several unsuccessful attempts, I was able to remove the bad patch from my main computer, and still no success in getting Chrome to work on an emulator. At this point I feel more certain that the problem lies with Android Studio 2.3. – John Moore Mar 12 '17 at 21:01
  • Please read this if you are under Windows: http://stackoverflow.com/a/43066809/2827025 – anemomylos Mar 28 '17 at 12:33
  • Update: I have made several changes since my last post involving emulator updates, installing Android Studio 3 (Canary 5), deleting/recreating emulators, etc. I am not sure which change was the magic one, but my emulators now accesses the internet without a problem. – John Moore Jul 02 '17 at 19:39
  • Possible duplicate of [Android Emulator is not connecting to internet](https://stackoverflow.com/questions/7252924/android-emulator-is-not-connecting-to-internet) (which also mentions you can manually specify a new DNS FWIW) – rogerdpack Oct 10 '17 at 02:20
  • 7
    I think this question is still good, as it is more 'general' than the cited one and also because it mentions the upgrade of Android Studio. As of april 2018, I have just upgraded it to version 3.1.2 and suddendly started to have this issue. – Shine May 05 '18 at 16:58
  • 98
    I don't understand why we have to waste so much time on this kind of problems. Android team ...just fix it! – r3dm4n May 12 '18 at 15:06
  • It's a bug on emulator, as [this issue](https://issuetracker.google.com/issues/70549904) suggests. – DaniloDeQueiroz Dec 28 '17 at 16:43
  • Anyone be informed: Try rebooting PC. I wasted hours eventually figuring out, it was not my fault ;) – Sold Out May 29 '19 at 14:22
  • 1
    My solution was delete saved network from the emulator setting and close emulator then run it back – Muhammad Asyraf Jun 03 '19 at 07:22
  • This should solve [Android Emulator wifi connected with no internet](https://stackoverflow.com/a/52765004/2815219). – Raman Sahasi Jul 11 '19 at 04:28
  • 4
    I deleted the emulator device and relaunch a new one, solved. I spent half a day struggling at this issue... I'm a fool. Android team, wtf, you are better than that!!! – KunYu Tsai May 13 '21 at 05:16
  • Your computer may already be using a proxy, custom dns or VPN. Try turning them off and you will see that emulator will connect. – okan Dec 04 '22 at 20:08
  • Worked for me: Closing the emulator tab (hit `x` on the emulator tab in Android Studio) then re-running the emulator worked for me. External URLs in the app. – Kalnode Jan 05 '23 at 17:53
  • In may case I click forget network and click the network name again to connect. No needed to re-run the emulator. Directly connected – Engin Yilmaz Jan 28 '23 at 13:49
  • *** DNS issue. *** Solved very quickly for me by starting emulator as per https://medium.com/@martin.crabtree/android-sdk-manually-setting-a-dns-for-android-emulator-6b14028e9667 – Andy Horton Jul 12 '23 at 09:54

66 Answers66

806
  • 1st try "Cold booting" the emulator as suggested here.

  • If cold booting doesn't work, try changing the DNS address of your network to 8.8.8.8 (Google's DNS) or another of your preference:

MacOSX:

  • Open "System Preferences"
  • Click on "Network"
  • Select the network which your computer is connected and click on "Advanced"
  • Select "DNS", Select the "+" button, type "8.8.8.8" (Google's DNS) or if you prefer OpenDNS, "208.67.222.222"
  • Select "Ok" and "Apply"

Windows & Linux:

https://developers.google.com/speed/public-dns/docs/using


After that close the emulator and start it again.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Ana Paula
  • 8,733
  • 3
  • 16
  • 16
  • I had to follow this guide for windows: https://developers.google.com/speed/public-dns/docs/using but it also worked for me. I guess for some reason my home network was not set correctly for the emulator. – Chud37 Aug 11 '18 at 18:17
  • 35
    If you don't want your DNS traffic going through Google, use OpenDNS settings instead. 208.67.222.222 and 208.67.220.220 – Justin Noel Oct 11 '18 at 16:58
  • 18
    I did the same, but then had to restart the emulator to get it to work, thanks for the tip though! – Steven Elliott Oct 26 '18 at 13:29
  • 3
    You can also instead of "brute forcing" your whole computer to use a new DNS server (And then by defaults having your emulator inherit those changes) just change the DNS settings for the emulator... There are a bunch of ways to do it. More details on the various options available here: https://stackoverflow.com/questions/2039964/how-to-connect-android-emulator-to-the-internet – trcarden Jun 16 '19 at 17:38
  • 3
    The problem is having partially invalid DNS settings in general. Reset them to something valid, and it'll work, doesn't have to be 8.8.8.8. My Mac was set up with 3 DNS servers, the first 2 of which were invalid. It still worked for other things since the third was ok, but I'm guessing the simulator only took the first two (it's common to only have primary and secondary) or is otherwise not as robust against this misconfiguration. – sudo Nov 27 '19 at 19:23
  • Timothy's answer to cold boot the device from the AVD manager is much more acceptable than this. I agree with @fl034 why resort to sending all my computer's traffic to google?? – Will Feb 26 '20 at 17:16
  • 1
    It worked for me. I passed from my office wifi to a personal one, then wiping the data or changing the boot mode didn't help. So...why adding the DNS (I didn't have any) worked? – Stefano Cremona Mar 25 '20 at 23:08
  • 1
    I've spent the last three days on this. At first I thought there was something wrong with GooglePlacesAutocomplete. Only now it occurred to me to check whether the emulator could connect to the internet at all and your answer did the trick. – Parzival May 08 '20 at 18:45
  • What is the solution for Mac OS? – IgorGanapolsky Jun 07 '20 at 19:02
  • 2
    I spent 2 hrs trying to debug why my emulator couldn't talk to Firebase and realised it was this issue. Hooray for dev experience. Get a grip Android team! – Sameen Jun 12 '20 at 17:20
  • 1
    THANK YOU SOOOO MUCH! Finally this worked for me :) – Rebar Jul 10 '20 at 21:27
  • I had to do both DNS and then COLD BOOT as suggested below. Thanks – Taylor A. Leach Mar 16 '21 at 20:32
  • well this happend to me when I was connected to company's lan. after unplugging lan cable and connecting laptop to wifi, the emulator had internet. shit. – Reza May 09 '21 at 11:24
  • For my case Android 4.2.1, i had to switch from Google DNS to Open DNS – Isaac Obella Jun 02 '21 at 03:44
  • Last night my emulator seems fine, at the morning my emulator cannot connect to the internet. IDK why it happened. but this solution really works. – Yohanim Aug 13 '21 at 07:05
  • It worked for me. I passed from my office wifi to a personal one. After spending one day. – kamatchi Sep 16 '21 at 08:40
  • First make sure that (cold) restart is not the only thing needed. – WerWet Dec 21 '21 at 17:29
  • Actually, latest Emulator does no longer allow changing DNS Server, but what matters more is that: – Top-Master May 06 '22 at 07:59
  • The only reason above works is because it causes a reconfigure of Emulated network, and the "Cold Boot Now" [suggestion](https://stackoverflow.com/a/50165129/8740349) should be the accepted answer instead. – Top-Master May 06 '22 at 08:03
  • Cold boot worked for me. Ty – Man1s Dec 02 '22 at 09:23
  • It had previously 2 DNSs directions, but I didn't save them and now they're deleted by the Google DNS I used. 1. What were those DNSs about? 2. Is it dangerous now that I have it using google? – Jhonatan Aug 18 '23 at 01:26
432

After trying many of these solutions, I was going to just delete my current AVD and make it again, but when I clicked the down arrow on the AVD, I noticed "Cold Boot Now".

AVD Menu

On a whim I tried that. Lo and behold my emulator has internet connectivity again!

Command-line approach

In case you start Emulator through command, pass -no-snapshot-load option, like:

%ANDROID_HOME%/emulator/emulator.exe -netdelay none -netspeed full -no-snapshot-load -avd Pixel_2_API_28

Or for MacOSX:

$ANDROID_HOME/emulator/emulator -netdelay none -netspeed full -no-snapshot-load -avd Pixel_2_API_28

Note that you may need to change -avd Pixel_2_API_28 part (with your own Virtual-Device name).

Also, most tools use ANDROID_HOME environment-variable name, hence define that (if not already), but nowadays ANDROID_ROOT is yet another naming-option.

Decision (edit)

Ok, for those saying why not just wipe data and restart. Do you reformat your PC every time you restart it? Wiping data on the emulator is just like doing a factory reset to a phone or reformatting your hard drive on your PC and reinstalling your OS. It is unnecessary unless the data is totally corrupt.

When you shut off the emulator and restart it, it is like putting your PC in hibernate or sleep mode. Memory is not wiped, it is saved.

Doing a cold boot is the same as rebooting your phone or rebooting your PC. It resets memory and lets things reload. This allows the network emulation to start with clean memory and connect properly.

So, don't wipe your data. Just cold boot. If it still doesn't work, then wipe, but save that as a last resort.

Top-Master
  • 7,611
  • 5
  • 39
  • 71
Timothy Winters
  • 5,481
  • 1
  • 15
  • 18
  • 16
    This fixed it for me after switching from wired to wifi – Lucas Jun 03 '18 at 03:24
  • 4
    Works for me too, facing the same problem switching between different networks adapters. The problems seems to be that the emulator is still somehow connected to the previous connection configuration, so when the emulator is start with Cold Boot Now the network config is restarted and everything start working again. Thanks for sharing ;)!! – Gueorgui Obregon Jul 13 '18 at 14:01
  • 6
    Works fine! but why? – ucMedia Feb 14 '19 at 15:46
  • 2
    Do you wipe your phone every time you reboot? That's what a cold start is on the emulator, a cold reboot. It's the same as shutting off your phone and turning it back on. There is no need to wipe data from the emulator after a cold boot unless it still has issues. – Timothy Winters Jun 18 '19 at 12:56
  • 2
    This worked for me.. I tried different proxy , tried reboot, created different AVD.. Not sure why this worked.. but worked..!! – Swapnil Kale Jul 25 '19 at 16:39
  • yeah we need certs to work with our proxy. Wiping is not a solution as we have to reinstall 3 certs everytime. – FlavorScape Sep 27 '19 at 17:27
  • 1
    I wish the Google Android team could add a network management tool to the Emulator so that changing from wired to wireless on the host computer would not lead to these weird errors! #iwish – superus8r Oct 14 '19 at 12:53
  • This solution solved my problem. After changing the Wifi router, the Emulator did not connect to the internet and this simple solution solved it. Congrats! – Wedson Quintanilha da Silva Aug 31 '20 at 22:24
  • Nice one bro :-) – kgori_dev May 23 '21 at 16:11
  • 1
    after 4 hours of trying this worked for me ! thank you bro – Yasser Sinjab Jul 23 '21 at 16:18
  • I usually set this option (Cold boot) when create an emulator. But it hadn't helped now, because I use VPN. See https://stackoverflow.com/a/42784657/2914140. – CoolMind Sep 15 '21 at 14:49
  • I am working behind a corporate firewall that seems to always be in my way - this was a life saver. – server_unknown Oct 12 '22 at 17:26
  • I guess android emulator saves network configurations and does not refresh them. For example, many OSes cache DNS. Maybe it is similar to this. – nurgasemetey Feb 02 '23 at 12:46
181

I found a temporary solution on an old Stack Overflow thread at Upgraded to SDK 2.3 - now no emulators have connectivity. Note that this thread talks about Android SDK 2.3, not Android Studio 2.3. The problem seems to be that the emulator can't find the DNS my computer is currently using, and the temporary workaround is to start the emulator from the command line and specify the DNS server. Whatever problem occurred back then must have reappeared in the latest version of Android Studio.

The temporary solution outlined below fixes the problem with the emulator accessing the internet. However, it does not fix the problem that occurs when trying to run Android Device Monitor. Doing so will still make the emulator go offline as described above.

Note that there are two files named "emulator.exe" in the sdk -- one under sdk\tools and another under sdk\emulator. Either might work below, but I use the one under sdk\emulator.

The first step is to find where the SDK is located. Assuming a user name of "jdoe" and a default installation of Android Studio on Windows, the SDK is most likely in

C:\Users\jdoe\AppData\Local\Android\sdk

The second step is to determine the name of the AVD (emulator) that you want to run. The command

C:\Users\jdoe\AppData\Local\Android\sdk\emulator\emulator.exe -list-avds

will show the names of your AVDs. On my computer, it shows only one, Nexus_5X_API_25.

To start the emulator from the command line with a specified DNS server, use something like the following:

C:\Users\jdoe\AppData\Local\Android\sdk\emulator\emulator.exe -avd Nexus_5X_API_25 -dns-server 8.8.8.8

In this case, 8.8.8.8 is a Google public domain name server.

The above commands can be shortened if you create appropriate environment variables and edit your PATH environment variable, but I recommend caution when doing so.

Prashant Pokhriyal
  • 3,727
  • 4
  • 28
  • 40
John Moore
  • 7,282
  • 3
  • 14
  • 14
  • This absolutely worked for me, but I wish there was a way to clean up the DNS outside the command line. – JaviCasa Jul 24 '17 at 06:34
  • after paying 199$ license for windows pro to get Hyer-V and after discovering that the visual studio emulator doesn't support google_api_services, i found this solution that make the android emulator to connect internet... I feel like :| – Monah Dec 27 '17 at 07:53
  • 2
    This totally works, but unbelievable this is still an issue with Android Studio 3.0 (emulator 27.1.12). Maybe related to having both wired and wireless network adapters in the system with wireless disabled? – Victor Rendina Mar 23 '18 at 13:02
  • I filed a bug with Google and I hope they review the comments here and resolve whatever the underlying issue is. – paws Apr 20 '18 at 15:26
  • @paws could you link the bug that you've filed? Want to star it as well! – amitavk May 07 '18 at 19:56
  • @amitav13 If you want to take the reins on the bug report, please feel free. I had to move on, but just posted an update telling the reviewer to be on the look out for other folks. – paws May 08 '18 at 22:06
  • @JaviCasa There is another way to set DNS outside the command just check the new answers for this post – Deepak N Jan 16 '19 at 12:37
  • I think this is a better solution; it's not always possible to override DNS at the OSX level (for example, my work machine has specific DNS settings which are required). – stephen mc Mar 15 '19 at 16:43
  • 2
    Thanks! Mac OS: `~/Library/Android/sdk/emulator/emulator -avd Pixel_2_API_28 -dns-server 8.8.8.8` – J. V. Apr 02 '19 at 06:58
  • Thanks! I created a .bat file to make it easier to open the emulator – Rodrigo João Bertotti Apr 12 '20 at 22:16
  • Thanks! It works for me if use VPN that restricts emulator Internet connection. – CoolMind Sep 15 '21 at 14:33
133

[UPDATE 2022] for Mac Users

For NOT Apple Silicon users

  1. System Preferences
  2. Network
  3. WiFi > Select Advanced
  4. From Advanced Choose DNS tab
  5. Add DNS Server 8.8.8.8
  6. Emulator must be restarted after DNS Server has been added (Thanks to @kapusch)

For Apple Silicon users

as per @bourdier-jonathan You can fix the Silicon issue here: Emulator appearing offline on M1 Mac after the last update of arm64-v8a

By replacing the AVD system images you have downloaded with the r02 images. Because It appears r03, r04, and r05 all don't work on m1

Basil Mariano
  • 2,437
  • 1
  • 20
  • 13
78

Updating my WIFI adapter to resolve DNS on 8.8.8.8 solved the issue for me. It started to happen after an Apple update which messed up the DNS address.

enter image description here

Joao Gavazzi
  • 1,818
  • 18
  • 8
  • 18
    Don't forget to restart the emulator after making this change, as Ana Paula suggests. – Jordan Jul 26 '18 at 16:31
  • 1
    See my comment above about using OpenDNS instead of Google. https://stackoverflow.com/questions/42736038/android-emulator-not-able-to-access-the-internet/49332186#comment92453401_49332186 – Justin Noel Oct 11 '18 at 16:59
  • Doesn't have to be 8.8.8.8 or OpenDNS, any working DNS server will work – sudo Nov 27 '19 at 19:25
54

Simply open the AVD Manager and wipe the data of that emulator works for me.

Hashim Zahid
  • 607
  • 6
  • 9
  • 3
    It must of had my old wifi connection cached, because I moved to another wifi location and this issue started happening. I wiped the AVD and restarted and it picked up the wifi at the new location. – Mike Flynn Oct 02 '18 at 13:27
  • After wipe data it failed to launch the emulator and shows the AVD was killed message – sejn Jul 31 '20 at 06:08
  • 1
    It help me as well. Wipe data is working. – Koray Güclü Aug 12 '21 at 11:32
46

Open Android emulator and go to the Extended Controls. Then go to the setting => proxy(Tab), uncheck "Use Android studio HTTP proxy setting" and click "Apply".

AminRah
  • 590
  • 5
  • 9
44

macOS: long Story short.. make sure your DNS settings 8.8.8.8 is the first in line, wipe your data and do a cold boot.

enter image description here

Cyber
  • 2,194
  • 4
  • 22
  • 41
39

Reminder: the Android Emulator internet connection does not work if you turn on a VPN system on you computer.

s__ale
  • 543
  • 5
  • 9
  • 4
    I had this issue, it helps to boot the emulator with no VPN connections and only after it booted, connect to your VPN of choice – Pierre Oct 07 '20 at 06:44
  • 1
    Yes it does for me. I just have to start emulator after VPN is connected. – DustinB Jul 15 '21 at 04:36
  • If your VPN restricts use of emulator, start it in command line, see https://stackoverflow.com/a/42784657/2914140. – CoolMind Sep 15 '21 at 14:51
  • 1
    Thanks, disabling the company VPN works... – Carra Jan 19 '22 at 10:25
  • That was it. I had to do a cold boot to make it work too. – Geekarist Jan 28 '22 at 08:17
  • This! For some reason company VPN started interfering with emulator, worked before – lietus Aug 31 '22 at 19:40
  • Thanks! To restore network and after continue to use VPN: 1. First disable VPN 2. Turn off and turn on WIFI on your AVD 3. Check network when WIFI is on 4. Open your app 5. ENable VPN connection from your pc 6. Now request from ADV pass thourgh VPN (Like login) – Stefano Spkg Gagliardi Feb 15 '23 at 15:02
30

I experienced this same issue after upgrade. Upon opening the Chrome browser in the emulator, google.com could no longer be reached.

I found a post on SO that suggested the problem was with the emulator trying to use a disconnected network adapter. For me the problem was occurring when I was connected to a LAN. Disabling the wireless LAN adapter fixed the issue.

To disable the adapter:

  1. Navigate to Network connections
  2. Find the adapter
  3. Right click and choose disable
Community
  • 1
  • 1
bmul
  • 390
  • 3
  • 7
  • 2
    Thanks for the tip. I was beginning to suspect something like this since I noticed that connecting via the wired LAN adapter also solved the problem. It should also be possible to fix this problem by changing the priority of the two adapters, but either way seems to be a drastic fix. Why can't Google simply fix the emulators to use the connection that my computer is using. As I said, this was not an issue before I upgraded to Android Studio 2.3. For now I will stick with the other solution where I specify the DNS server. – John Moore Mar 17 '17 at 12:13
  • Thanks. I have LAN and wireless adapter. Working after disable wireless adapter. – Plugie Jul 22 '17 at 09:28
  • Exactly! I have turned off all my PCs network adapters excluding my WiFi adapter and this worked. Thank you. – Alexander.Iljushkin Dec 29 '17 at 22:19
30

I've resolved wiping data from AVD Manager

Blasco73
  • 2,980
  • 2
  • 24
  • 30
  • 4
    It works for me. I'm my case I was using emulator with API 22. After "Wipe Data" and "Cold Boot Now" the internet conection works fine, but I had to reinstall the app. – Akostha Oct 08 '18 at 16:57
20

This happend to me when the emulator froze and I had to kill the process. The signal icon always showed the small "x" as in the screenshot and no internet connection was successful.

The only thing that helped was uninstalling and reinstalling the emulator (not the AVD images)

In Android Studio:

Tools-> Android -> SDK Manager Uncheck "Android Emulator" and let it uninstall then check again and let it install again.

Screenshot

Patrick
  • 33,984
  • 10
  • 106
  • 126
  • 3
    Had the exact same problem, did this and the problem wasn't fixed. But after rebooting the whole computer the internet is now working on the emulator. – antogerva Jun 01 '17 at 03:26
  • it's working for me, my situation .. reinstall android studio i used old my SDK files – Thamays Jun 16 '17 at 13:49
  • 6
    This is the only solution that worked for me (on a Mac fyi) – vikzilla May 02 '18 at 21:52
  • Have to agree that this was the only solution also worked on a mac! – Anoop Santhanam Feb 25 '20 at 02:37
  • I noticed that Android Emulator had an upgrade from 30.6.x to 30.7.5. I just upgraded it and everything suddenly started working for me. I tried all sorts of things such as the plethora of "DNS=8.8.8.8" suggestions and nothing worked except upgrading Android Emulator. – DustinB Jul 15 '21 at 04:36
  • works on Arch Linux. I deleted a snaopshot inside teh advanced emu settings , the emu wants to restart, then crashes, after that all network gone , for ALL emus. This fixed it , and only this. THX – CaptainCrunch Feb 28 '22 at 17:38
  • when installing again, ensure delete the emulator folder under sdk path – Ram Dec 12 '22 at 09:30
20

I am also facing the same problem, but I am trying to solve the problem using various posts. Today I discovered this problem. Your computer configuration is most likely the problemm, not Android Studio and the Android Emulator.

The problem is coming from your Network setup. Just set the Primary DNS Server to 8.8.8.8, which will solve the problem.

Jason
  • 1,658
  • 3
  • 20
  • 51
Swarup Daptari
  • 309
  • 2
  • 3
19

I got a simple and permanent solution for this issue in windows.

Go to network and internet option-> enter image description here

click on Etherenet or wifi(for which you are connected) option -> enter image description here

Click on change adapter option -> enter image description here

Right click on the network for which you have connected. enter image description here

A dialog box will be opened and just click on Internet protocal version (TCP/IPv4) option. enter image description here

Another dialog box will be opened and there just neglect the first set about the IP address (Keep as it is set) and click radio button of Use the following DNS server addresses: and enter as 8.8.8.8 in Preferred DNS server: and 8.8.4.4 in Alternate DNS server: enter image description here

Now you can open your emulator whenever and you will get internet in the android emulators.

Deepak N
  • 1,408
  • 3
  • 15
  • 37
  • 2
    None of the other solutions worked for me, but this one worked! As a mention: I'm on LAN cable, so I've made the changes on this setting instead of the Wifi connection. – Zbarcea Christian Jan 16 '19 at 10:12
  • 1
    Thanks for the details in this comment.It helped me solve my problem. – Ekane 3 Feb 22 '21 at 15:30
10

For me the problem was caused when I took my laptop home without restarting the emulator. From what I have read, when the emulator starts up it reads your PC's DNS settings and uses them. When I was on my home network, my work DNS settings were failing.
So yeah. Just restarting the emulator solved my problem.

smithygreg
  • 525
  • 1
  • 7
  • 11
9

This was a problem for me last time the emulator updated itself and back then disabling other network adapters fixed it. Now it's cropped up again but the only adapter that is enabled is a single wifi one so I have nothing to disable.

The issue only reappeared after I updated via a prompt the emulator tools to 26.1.1. I uninstalled and reinstalled the emulator via the SDK Tools update tab and thankfully the only option when installing again right now is to install 26.0.3 (which seems to be working okay).

Moral of the story is to be very wary of emulator updates.

Daniel Wilson
  • 18,838
  • 12
  • 85
  • 135
8

After 10 days of trouble, I just deleted everything from C:\Android\.android\ and deleted all created AVDs. Now internet seems to work fine.

8

I faced this problem after i kept my emulator ON while going from my home to a cafe. "Cold Boot Now" fixed the issue.

div
  • 1,475
  • 3
  • 22
  • 32
8

Just goto AVD manager and Cold Boot Now worked for me

Hassan Kalhoro
  • 182
  • 2
  • 8
7

closing the emulator and reopening worked for me

OS WINDOWS 10

IAMSTR
  • 618
  • 8
  • 12
  • 2
    That worked for me. I have tried with restarting the virtual phone, but it was not enough. The issue might be triggered by allowing the running emulator through hibernate. Thanks. – Alexei - check Codidact May 30 '20 at 07:34
7

I can make it work after turn off and turn on the wifi on android config

Turn on and off wifi

Wildan Muhlis
  • 1,553
  • 2
  • 22
  • 43
6

Please go through the below link.

https://developer.android.com/studio/run/emulator-networking

Emulator open, click More ..., and then click Settings and Proxy. From here, you can define your own HTTP proxy settings.


Enter the hostname by following Run > cmd > hostname

Finally, check the internet access inside the emulator by browsing in chrome or google.

Note: Often wipe data will clear the issue. Please follow all steps

Jayakumar Thangavel
  • 1,884
  • 1
  • 22
  • 29
5

I am on android studio 3.1 and it happened. Solved it by restarting the adb server

$ adb kill-server
$ adb start-server

Hope it helps. Thank you

surga
  • 1,436
  • 21
  • 25
5

There was a problem for me too, by disabling the proxy in Android Studio settings, and run the emulator with "Cold Boot Now", the problem was resolved.

Farid Savad
  • 163
  • 1
  • 11
5

Solution for MacOS that does not use a custom DNS for your whole machine

Step 1

Locate the emulator executable Android Studio is using inside the Android SDK and rename it to emulator-original.

Mine is located /usr/local/share/android-sdk/emulator/emulator but it might vary based on individual setups.

Step 2

Add a new file called emulator in the place of the original file containing the following command (or using your DNS server of choice).

#!/bin/bash
$0-original "$@" -dns-server 8.8.8.8

Step 3

Make the new emulator file executable.

chmod +x emulator

Step 4

Restart the emulator using Android Studio.

Ben Manwaring
  • 61
  • 1
  • 3
5

Try these steps once, they worked for me:

  1. Disconnect your PC from the internet
  2. Close the emulator while you are still disconnected
  3. Again connect to the internet
  4. Finally start your emulator again
artenson.art98
  • 1,543
  • 15
  • 15
5

Apple MacBook M1

None of the answers worked for me on a m1 mac, I was not even able to connect to localhost for the react-native development server.

The trick for me was to turn off the cellular data "T-mobile," then it would use AndroidWiFi for internet and everything worked fine.

Here's a screenshot of my working settings: android network screenshot

Scott Jungwirth
  • 6,105
  • 3
  • 38
  • 35
4

if android browser can access internet you can run emulator from terminal by this command

go to SDK path then

$ /tools/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

it solve your internet problem...

Man
  • 742
  • 1
  • 6
  • 23
4

I was having the same issue and i resolved with below steps:-

Go to emulator setting and then go to

setting->Proxy->Either configure it Manually or use Tick use Android Studio HTTP proxy simulator.

please vote, if this works for you

Naveen rana
  • 101
  • 6
4

1-set no proxy

enter image description here

2-invalidate caches

enter image description here

3-remove old emulators and add new one

Milad Ahmadi
  • 1,019
  • 12
  • 19
4

With Some Indian ISPs and others, there is some issue with IPv6 routing which leads to the problem of our app not connecting to the internet or the backend API server.

To resolve this, We can manually assign the IPv4 addresses to the emulator which resolves this issue.


  1. First let's note down the IP address dynamically being assigned to your emulator.

    You can see this by going to the emulator's Settings -> Network & Internet -> Internet Android Wifi -> Android Wifi.
    Note down the IPv4 address, Gateway, and subnet mask.

Dynamic IP

  1. Now click on the top right Edit icon. Click on Advance options. Select IP settings to static. Enter the IP address you have noted down in the previous step. and in the DNS1 use 8.8.8.8. Click on the Save button. Now your internet should work.

Static Ip assignment

Deˣ
  • 4,191
  • 15
  • 24
3

Just recreating the emulator with another target API worked for me

Faheem
  • 930
  • 10
  • 7
3

Maybe you set a proxy for Android Studio and the proxy does not work. Try without proxy.

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
user6022289
  • 65
  • 1
  • 7
3

As pointed by @osama buzdar, the DNS settings the emulator looks first might be specified in /etc/resolv.conf. In my case, as of macOS Catalina 10.15.7, there was 2 addresses in that file: the first one was a IPv6 and the second, IPv4 and for some reason the emulator was probably having trouble with the IPv6.

Then I edited the file (sudo vi /etc/resolv.conf) and moved the IPv4 up to be the first entry of the file, before the IPv6. Restarted the emulator and it worked.

Andre Ravazzi
  • 611
  • 7
  • 10
  • This solution solves it until the resolv.conf is regenerated... – Hugo Logmans Jan 13 '22 at 14:26
  • Add -dns-server 8.8.8.8 or something like that as extra argument. e.g. within Visual Studio you can provide extra arguments for the call to AVD, and this solves is for good. – Hugo Logmans Jan 17 '22 at 07:50
2

I've faced the very and suddenly same problem on my MAC. After having tried everything, I've finally deleted the folder /Users/Philippe/.android and create a new emulator.

Phil
  • 4,730
  • 1
  • 41
  • 39
2

Pro tips: using AVD with dnsmasq on Linux

To understand you to read Set up Android Emulator networking from Android Studio.

The loopback of the emulated device is 127.0.0.1 and the host loopback can be accessed from the emulated device from 10.0.2.2.

At startup, the emulated device set its DNS nameserver by picking those from the host in /etc/resolv.conf.

But the point is, if you are using dnsmasq, you setnameserver 127.0.0.1in/etc/resolv.conf` so the emulated device will hit it's own loopback where nothing is running instead of the host loopback where there is a DNS server running.

To solve that, add -dns-server when running AVD from the CLI.

For example:

  • Cloudflare DNS: ~/Android/Sdk/emulator/emulator -avd Nexus_9_API_23 -dns-server 1.1.1.1
  • Host's dnsmasq: ~/Android/Sdk/emulator/emulator -avd Nexus_9_API_23 -dns-server 1.0.2.2
noraj
  • 3,964
  • 1
  • 30
  • 38
  • AVD picks the first DNS entry. And does not support IPv6, so in my autogenerated resolve.conf the IPV6 address is stated first, and that fails the AVD. Using -dns-server options solves this problem. 8.8.8.8 is also a valid DNS entry (Google) – Hugo Logmans Jan 17 '22 at 07:52
2

I am having visual studio 2017 , and this simple few click has fix internet issue for Android emulator.

enter image description here

HO LI Pin
  • 1,441
  • 13
  • 13
2
  1. first:open airplane mode.
  2. second:connect to emulator wifi.
Peter
  • 47
  • 2
2

For Apple MacBook M1 users

Working as of 1 Feb 2022

  1. Open Android emulator
  2. Go to Extended Controls.
  3. Then go to setting under proxy ( Tab ),
  4. uncheck Use Android studio HTTP proxy setting
  5. click Apply
  6. Restart / cold boot your emulator.

This should fix the internet connectivity issue on your emulator.

Vicky Salunkhe
  • 9,869
  • 6
  • 42
  • 59
1

I had this also and I solved it by creating new android emulator virtual device and chosen Nexus 4 api 27. Before I was creating Pixel device api 28, and it was not working even after recreating device. So I tried totally different configuration and Android Emulator has internet connection as is expected. Other solutions did not work for me but I did no try it all.

Renetik
  • 5,887
  • 1
  • 47
  • 66
1

For me the problem was my computer was connected to VPN. Once I disconnected that it started working in emulator.

Koustuv Ganguly
  • 897
  • 7
  • 21
1

For me on OSX, it was because of using a 3rd party VPN solution...it installs some sort of network hook that AVDs and Genymotion couldn't route through. Had to uninstall it for it work properly. Worked fine on some networks and not on others...was very weird..

kenyee
  • 2,309
  • 1
  • 24
  • 32
1

Emulators w Android 9+ worked for me but Android 7 would not connect to the internet.

My office uses Little Snitch application firewall. I turned it off and Android 7 worked. Probably a good idea to check your firewalls.

Peter Hollingsworth
  • 1,870
  • 1
  • 18
  • 18
1

If you are behind a proxy, the following might be useful:

adb shell settings put global global_http_proxy_port YOUR_PROXY_PORT

adb shell settings put global global_http_proxy_host YOUR_PROXY_IP

reboot
narko
  • 3,645
  • 1
  • 28
  • 33
1

set DNS 8.8.4.4 and run emulator -avd react-native-device -dns-server 8.8.4.4

this work for me

1

The Mobile data setting requires to be turned on. Did a cold boot it didn't work but after I turned on Mobile Data it worked

John Gathairu
  • 35
  • 1
  • 7
  • Welcome to SO! Please read the [tour](https://stackoverflow.com/tour), and [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer) – Tomer Shetah Nov 15 '20 at 12:08
1

On Latest Mac with Jio IP6 Configuration issue ,it block internet on android simulator ,so from Android Virtual Device Manager simulator list Actions column dropdown select the option "Cold Boot Now" fixed the issue.I faced this problem after i kept same its working for me.

Ram krishna
  • 99
  • 1
  • 2
1

None of these answers worked for me. I was able to get it working though by downloading the canary build "android-studio-2021.1.1.8-mac_arm". No extra steps were needed after that.

Jake
  • 383
  • 6
  • 26
1

I don't know if this could help anyone, what worked for me was to set the date and time on the android settings of the emulator to the correct (current) date and time, looks weird.

1

For me, I went to the connectivity settings in emulator and disconnected Android WiFi. Then inside this, I pressed Forget Connection. Now again connecting to the same WiFi solved the issue. Quickest way to resolve this I think!

hardik parmar
  • 853
  • 8
  • 15
1

First, open the AVD Manager in android studio  and Click on Wipe the data of that emulator and after that click on Cold Boot Now . If that doesn't work, try changing your network's DNS address to 8.8.8.8 (Google's DNS) or another DNS of your choice.

  • DNS option worked for me! like can anybody tells me why Google keep doing this mistake! – MBH Jun 28 '23 at 13:48
0

Had the same issue with my emulator,did everything above but nothing worked. Changing the Default gateway in my Control Panel -> Network and Sharing Center -> Local area connection settings from: 192.168.1.119 to 192.168.1.1 worked from me. I don't have much idea about how this IP Address works,but maybe it will save someone's time and frustation.

bhavya joshi
  • 1,096
  • 10
  • 20
0

Same Network Connectivity issue for me in android emulator V 7.1.1, Then I have decreased the Android Version below 7.1.1 in my Android Emulator then its work fine.

  • One thing that may be required on newer versions of Android is to enable http traffic in the manifest if you are trying to open http websites: android:usesCleartextTraffic="true" – Andrey Petrov Jun 21 '19 at 21:50
0

I had the same problem on Windows 10. I just went to the Network & internet settings> Change adapter options> right-click on Wi-Fi and chose properties> Chose Internet protocol version 4 in the list and clicked properties> Turned on the "Use the following DNS server addresses" and filled the first part with "8.8.8.8" address. Problem solved!

Hasani
  • 3,543
  • 14
  • 65
  • 125
0

In my case it was the Charles proxy app. Even closing the app the emulator still can not access the internet. Needed to stop listening for network in Charles.

Ignacio Tomas Crespo
  • 3,401
  • 1
  • 20
  • 13
0

I know this is old. But it helped me a bit. I encountered the same problem in Xamarin.Forms application. My emulator was unable a connect to a public api.

I fixed the problem by starting the emulator with factory defaults in Android Device manager.

enter image description here

Ndubuisi Jr
  • 461
  • 6
  • 13
0

What I have observed is that when you switch wifi connections when the android emulator is running. It isn't able to connect to new wifi.

A simple solution is to restart the android emulator.

Amir Dora.
  • 2,831
  • 4
  • 40
  • 61
0

If you have PiHole on your network, make sure that your Pi is working and you can access the PiHole's web UI. Every single time, when my Emulator all the sudden not getting internet connection is because something is up with either one of them.

S0und
  • 257
  • 4
  • 12
0

The Cold boot option works for me

vikas aggarwal
  • 468
  • 3
  • 9
0

Windows DNS settings are specified in the TCP/IP Properties window for the selected network connection.

Example: Changing DNS server settings on Windows 10

Go to the Control Panel. Click Network and Internet > Network and Sharing Center > Change adapter settings. Select the connection for which you want to configure Google Public DNS. For example:

To change the settings for an Ethernet connection, right-click the Ethernet interface and select Properties. To change the settings for a wireless connection, right-click the Wi-Fi interface and select Properties. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

Select the Networking tab. Under This connection uses the following items, select Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol Version 6 (TCP/IPv6) and then click Properties.

Click Advanced and select the DNS tab. If there are any DNS server IP addresses listed there, write them down for future reference, and remove them from this window.

Click OK.

Select Use the following DNS server addresses. If there are any IP addresses listed in the Preferred DNS server or Alternate DNS server, write them down for future reference.

Replace those addresses with the IP addresses of the Google DNS servers:

For IPv4: 8.8.8.8 and/or 8.8.4.4. For IPv6: 2001:4860:4860::8888 and/or 2001:4860:4860::8844. For IPv6-only: you can use Google Public DNS64 instead of the IPv6 addresses in the previous point. Test that your setup is working correctly; see Test your new settings.

Repeat the procedure for additional network connections you want to change.

macOS DNS settings are specified in the Network window.

Example: Changing DNS server settings on macOS 10.15

Click Apple menu > System Preferences > Network. If the lock icon in the lower left-hand corner of the window is locked, click the icon to make changes, and when prompted to authenticate, enter your password. Select the connection for which you want to configure Google Public DNS. For example: To change the settings for a Wi-Fi connection, select Wi-Fi, and click Advanced. To change the settings for an Ethernet connection, select Built-In Ethernet, and click Advanced. Select the DNS tab. Click + to replace any listed addresses with, or add, the Google IP addresses at the top of the list: For IPv4: 8.8.8.8 and/or 8.8.4.4. For IPv6: 2001:4860:4860::8888 and/or 2001:4860:4860::8844. For IPv6-only: you can use Google Public DNS64 instead of the IPv6 addresses in the previous point. Click OK > Apply. Test that your setup is working correctly; see Test your new settings. Repeat the procedure for additional network connections you want to change.

Linux In most modern Linux distributions, DNS settings are configured through Network Manager.

Example: Changing DNS server settings on Ubuntu

Click System > Preferences > Network Connections. Select the connection for which you want to configure Google Public DNS. For example: To change the settings for an Ethernet connection, select the Wired tab, then select your network interface in the list. It is usually called eth0. To change the settings for a wireless connection, select the Wireless tab, then select the appropriate wireless network. Click Edit, and in the window that appears, select the IPv4 Settings or IPv6 Settings tab. If the selected method is Automatic (DHCP), open the dropdown and select Automatic (DHCP) addresses only instead. If the method is set to something else, do not change it. In the DNS servers field, enter the Google Public DNS IP addresses, separated by a comma: For IPv4: 8.8.8.8 and/or 8.8.4.4. For IPv6: 2001:4860:4860::8888 and/or 2001:4860:4860::8844. For IPv6-only: you can use Google Public DNS64 instead of the IPv6 addresses in the previous point. Click Apply to save the change. If you are prompted for a password or confirmation, type the password or provide confirmation. Test that your setup is working correctly; see Test your new settings. Repeat the procedure for additional network connections you want to change. If your distribution doesn't use Network Manager, your DNS settings are specified in /etc/resolv.conf.

Example: Changing DNS server settings on a Debian server Edit /etc/resolv.conf:

sudo vi /etc/resolv.conf

If any nameserver lines appear, write down the IP addresses for future reference.

Replace the nameserver lines with, or add, the following lines:

For IPv4:

nameserver 8.8.8.8
nameserver 8.8.4.4

For IPv6:

nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844

For IPv6-only, you can use Google Public DNS64 instead of the above IPv6 addresses.

Save and exit.

Restart any Internet clients you are using.

Test that your setup is working correctly; see Test your new settings.

Osama Buzdar
  • 1,115
  • 10
  • 20
0

One of the quick and easiest way to solve this is choose a device with API 29 or below, there is some issue on higher API for the internet. The DNS thing was not working for me, so I tried degrading the device API level, and chrome, etc. started working. My application however was able to use the internet as we were able to fetch the data from BackEnd on higher API but having chrome issues testing some other functionality.

0

To me, I have just restarted the Mac, and the internet working again without any issues.

-1

I've been having this issue for the past 8 hours, figuring out a way to solve it. It happened after my house had a power outage. My emulator would not longer connect to my pc's internet. I tried every solution here. The changing DNS to 8.8.8.8 worked, but I didn't want to route all my traffic through google.

What FINALLY worked was. I know this is insane, but unplugging my wifi router/modem. One quick unplug and replug fixed this issue. I TRIED EVERYTHING on this SO question and 5 other questions. I even redownloaded Android Studio and the Emulators. None of it worked. Try unplugging your router/modem.

DIRTY DAVE
  • 2,523
  • 2
  • 20
  • 83
-1

Overriding the DNS in the Android emulator works for me.

On the device (Android 9+):

  • Go to Settings > Network & Internet > Advanced > Private DNS.
  • Select Private DNS provider hostname.
  • Enter dns.google as the hostname of the DNS provider.
  • Click Save.
edwardmp
  • 6,339
  • 5
  • 50
  • 77
-2

Finally, I had to delete the .android folder and create new one. It seems that the files got corrupted

Rohit Mandiwal
  • 10,258
  • 5
  • 70
  • 83
-4

go to your adapter setting and change the dns to 8.8.8.8 which is google's and it will work,it worked for me

Ajit Paul
  • 199
  • 3
  • 3