Android emulator not able to access the internet
Asked Answered
E

62

559

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

Espinosa answered 11/3, 2017 at 13:53 Comment(16)
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.Espinosa
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.Espinosa
Please read this if you are under Windows: https://mcmap.net/q/35825/-android-emulator-is-not-connecting-to-internetTenner
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.Espinosa
Possible duplicate of Android Emulator is not connecting to internet (which also mentions you can manually specify a new DNS FWIW)Elwood
It's a bug on emulator, as this issue suggests.Terce
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.Frederickfredericka
Anyone be informed: Try rebooting PC. I wasted hours eventually figuring out, it was not my fault ;)Solley
My solution was delete saved network from the emulator setting and close emulator then run it backAerification
This should solve Android Emulator wifi connected with no internet.Whaleboat
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!!!Inseparable
Your computer may already be using a proxy, custom dns or VPN. Try turning them off and you will see that emulator will connect.Eachern
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.Bootlace
In may case I click forget network and click the network name again to connect. No needed to re-run the emulator. Directly connectedDaisydaitzman
*** DNS issue. *** Solved very quickly for me by starting emulator as per medium.com/@martin.crabtree/…Symptomatic
It's now 2024, this issue has been a constant nuisance for close to a decade, and judging by the (many) still open bug reports the Android team seems to care very little. I ended up using the iOS emulator instead (which works PERFECTLY) for our cross-platform project because getting Android to work is seemingly impossible. Great DX, Google. Great DX.Nisen
G
837
  • 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.

Gustation answered 17/3, 2018 at 3:22 Comment(21)
I had to follow this guide for windows: 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.Selfeducated
If you don't want your DNS traffic going through Google, use OpenDNS settings instead. 208.67.222.222 and 208.67.220.220Jacks
I did the same, but then had to restart the emulator to get it to work, thanks for the tip though!Knobby
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: #2040464Plebeian
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.Disposition
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??Rizo
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?Gibeon
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.Krug
What is the solution for Mac OS?Showthrough
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!Toxicity
THANK YOU SOOOO MUCH! Finally this worked for me :)Outbound
I had to do both DNS and then COLD BOOT as suggested below. ThanksTridentine
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.Doldrums
For my case Android 4.2.1, i had to switch from Google DNS to Open DNSCastillo
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.Hygienics
It worked for me. I passed from my office wifi to a personal one. After spending one day.Protium
First make sure that (cold) restart is not the only thing needed.Quianaquibble
Actually, latest Emulator does no longer allow changing DNS Server, but what matters more is that:Staging
The only reason above works is because it causes a reconfigure of Emulated network, and the "Cold Boot Now" suggestion should be the accepted answer instead.Staging
Cold boot worked for me. TyNicknack
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?Bitty
O
453

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.

Overripe answered 3/5, 2018 at 23:34 Comment(13)
This fixed it for me after switching from wired to wifiBiggerstaff
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 ;)!!Melleta
Works fine! but why?Oversexed
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.Overripe
This worked for me.. I tried different proxy , tried reboot, created different AVD.. Not sure why this worked.. but worked..!!Genista
yeah we need certs to work with our proxy. Wiping is not a solution as we have to reinstall 3 certs everytime.Graubert
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! #iwishActinometer
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!Maidinwaiting
Nice one bro :-)Showoff
after 4 hours of trying this worked for me ! thank you broTyphogenic
I usually set this option (Cold boot) when create an emulator. But it hadn't helped now, because I use VPN. See https://mcmap.net/q/35811/-android-emulator-not-able-to-access-the-internet.Caudex
I am working behind a corporate firewall that seems to always be in my way - this was a life saver.Symbolize
I guess android emulator saves network configurations and does not refresh them. For example, many OSes cache DNS. Maybe it is similar to this.Quixotic
E
185

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.

Espinosa answered 14/3, 2017 at 11:23 Comment(11)
This absolutely worked for me, but I wish there was a way to clean up the DNS outside the command line.Hazeghi
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 :|Hungnam
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?Pasquinade
I filed a bug with Google and I hope they review the comments here and resolve whatever the underlying issue is.Tradesman
@Tradesman could you link the bug that you've filed? Want to star it as well!Pontefract
@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.Tradesman
@Hazeghi There is another way to set DNS outside the command just check the new answers for this postPanache
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).Ribeiro
Thanks! Mac OS: ~/Library/Android/sdk/emulator/emulator -avd Pixel_2_API_28 -dns-server 8.8.8.8Circumfluent
Thanks! I created a .bat file to make it easier to open the emulatorPyrazole
Thanks! It works for me if use VPN that restricts emulator Internet connection.Caudex
W
136

[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

Westward answered 28/2, 2020 at 4:37 Comment(12)
Good to know that emulator must be restarted after DNS Server has been addedValdemar
You are a superheroTroostite
Also make sure that the 8.8.8.8 DNS Server is the first on the DNS Servers list.Inartificial
This solution is not working for me as of 8/24/2021 and using the 20201-3-1 release.Glori
Not working now... Im using api 31 on apple siliconDrislane
let me check this out and get back to you.Westward
I just updated my Android Studio to 20201-3-1 release and used API 31 (Not on Apple Silicon Though) and it works fine.Westward
This solution is not working on Apple silicon with the Android Studio Arctic Fox | 2020.3.1 macOS 11.4Among
Not working in AS Archtic fox, any other solution?Messiaen
yes https://mcmap.net/q/35828/-emulator-appearing-offline-on-m1-mac-after-the-last-update-of-arm64-v8aForeboding
Great tip! It works as well for Apple silicon: Successfully tested with Android Studio 2021.1.1Simmon
Works for me when using wired network as well at 27.03.22Garbage
S
54

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

Scraggly answered 12/12, 2017 at 20:16 Comment(2)
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.Basham
After wipe data it failed to launch the emulator and shows the AVD was killed messageSmutchy
R
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".

Rotunda answered 3/5, 2018 at 8:57 Comment(3)
I on the other hand had to check it back again to make internet work. :(Mareah
worked like a charm, but had to restart the emulator for it to pick up the setting.Demotic
especially i had to make a cold boot after unchecking this option.Churchman
A
46

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

Antependium answered 10/12, 2020 at 9:50 Comment(2)
worked on my mac. should be marked as correct answer. By the way no need to wipe your data just in casePalfrey
No wipe was necessary for me, and worked like a charm, thanks mate.Honeysweet
L
43

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

Lanni answered 16/10, 2018 at 13:20 Comment(5)
I had this issue, it helps to boot the emulator with no VPN connections and only after it booted, connect to your VPN of choiceRandellrandene
Yes it does for me. I just have to start emulator after VPN is connected.Isiahisiahi
If your VPN restricts use of emulator, start it in command line, see https://mcmap.net/q/35811/-android-emulator-not-able-to-access-the-internet.Caudex
That was it. I had to do a cold boot to make it work too.Ting
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)Scalenus
B
31

I've resolved wiping data from AVD Manager

Brice answered 3/10, 2018 at 13:25 Comment(1)
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.Dupree
H
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
Hydric answered 16/3, 2017 at 15:31 Comment(3)
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.Espinosa
Thanks. I have LAN and wireless adapter. Working after disable wireless adapter.Goodrich
Exactly! I have turned off all my PCs network adapters excluding my WiFi adapter and this worked. Thank you.Estoppel
R
21

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

Ralston answered 27/5, 2017 at 8:49 Comment(5)
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.Camporee
it's working for me, my situation .. reinstall android studio i used old my SDK filesCosme
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.Isiahisiahi
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. THXGoingson
when installing again, ensure delete the emulator folder under sdk pathBellabelladonna
S
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.

Sidekick answered 26/1, 2018 at 16:50 Comment(0)
P
20

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.

Panache answered 11/1, 2019 at 6:53 Comment(1)
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.Catenary
L
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.

Liberate answered 19/9, 2017 at 20:19 Comment(1)
Simple and precise. It was my problem as well.Reest
S
10

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

Schizogony answered 28/3, 2023 at 4:33 Comment(0)
P
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.

Pretor answered 19/6, 2017 at 13:1 Comment(2)
Worked for me, had the exact same version, and after uninstalling, reinstalled 26.0.3.Consumptive
This solution worked for me too! I had to install 26.0.3 from Android Studio 2.3. though (the 3.0 preview only showed 26.1.1.). Thanks a lot!Johnjohna
C
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.

Carson answered 12/6, 2017 at 9:14 Comment(0)
H
7

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

Haiku answered 18/3, 2020 at 18:25 Comment(0)
G
7

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

Turn on and off wifi

Grume answered 29/1, 2021 at 6:23 Comment(1)
This worked for me. but you have to restart the emulator onceCompose
R
7

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

Rabinowitz answered 31/10, 2022 at 20:32 Comment(1)
Im using windows and this works on Android emulators in windows too ! Thanks this saved a lot of time :)Darky
A
6

closing the emulator and reopening worked for me

OS WINDOWS 10

Adamis answered 25/11, 2019 at 19:30 Comment(1)
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.Acquisitive
S
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

Scrofulous answered 13/4, 2018 at 4:57 Comment(1)
helped a lot thanks. i think sdk manager wasnt starting the server at allPhosphocreatine
T
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.

Torrell answered 20/12, 2019 at 15:50 Comment(0)
D
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.

Dynode answered 25/8, 2021 at 13:7 Comment(0)
J
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
Jugendstil answered 4/10, 2021 at 4:44 Comment(0)
A
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...

Alloway answered 19/2, 2018 at 7:9 Comment(0)
P
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

Privation answered 24/9, 2018 at 5:1 Comment(0)
B
4

1-set no proxy

enter image description here

2-invalidate caches

enter image description here

3-remove old emulators and add new one

Batting answered 22/2, 2022 at 6:37 Comment(0)
D
4

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.

Depolarize answered 31/5, 2023 at 11:55 Comment(1)
DNS option worked for me! like can anybody tells me why Google keep doing this mistake!Stripper
S
3

Just recreating the emulator with another target API worked for me

Shooin answered 3/8, 2017 at 13:54 Comment(0)
M
3

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

Michael answered 7/4, 2018 at 12:31 Comment(0)
G
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.

Granular answered 4/1, 2022 at 16:57 Comment(2)
This solution solves it until the resolv.conf is regenerated...Pellicle
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.Pellicle
P
3

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.

Psychotechnics answered 1/2, 2022 at 8:29 Comment(0)
G
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.

Granule answered 26/12, 2017 at 16:59 Comment(0)
D
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
Decarbonate answered 30/11, 2018 at 15:34 Comment(1)
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)Pellicle
F
2

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

enter image description here

Femininity answered 9/5, 2019 at 8:47 Comment(0)
I
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.

Imtiaz answered 2/11, 2017 at 23:32 Comment(0)
E
1

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

Electromotor answered 24/10, 2018 at 7:49 Comment(0)
M
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..

Mutual answered 19/1, 2019 at 13:39 Comment(0)
D
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.

Diacid answered 28/8, 2019 at 21:7 Comment(1)
this was culprit in my caseTroposphere
O
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
Overcurious answered 27/11, 2019 at 10:36 Comment(0)
L
1
  1. first:open airplane mode.
  2. second:connect to emulator wifi.
Lyse answered 16/8, 2020 at 14:57 Comment(1)
its work for me put in airplane mode and disable airplane mode on android 10 x86Brader
M
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

Multiplication answered 15/11, 2020 at 11:24 Comment(1)
Welcome to SO! Please read the tour, and How do I write a good answer?Keeley
G
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.

Glori answered 14/8, 2021 at 5:33 Comment(1)
I had to create as new virtual device (ARM-based) and only then it worked.Gunman
C
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.

Caliphate answered 16/5, 2022 at 2:0 Comment(0)
B
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!

Barnette answered 14/1, 2023 at 4:59 Comment(0)
S
1

This fixes the issue all times. Setup mobile data on the emulator.

Follow these steps on the android emulator.

  1. Turn off wifi.
  2. Then go to Access Point Names (APN). It will vary how to get here depending on the Android version. But could be similar to: Settings -> Network & Internet -> Advanced -> Access Point Names (APN) (If not then it should be something similar to that, but search for APN.
  3. Click "+" icon to add a new access point.
  4. Give it any name (eg. MyAccessPoint).
  5. Give it any APN (eg. APoint).
  6. Proxy: Just it case you are using a proxy, specify the url.
  7. Port: Specify proxy port if using a proxy.
  8. Username: Write anything (eg. user1).
  9. Password: Write any password (eg. pwd123).
  10. Server: Write *.
  11. Click on three dots icon at the top and click on Save.
  12. Select the radio button for previous APN.
  13. Turn on mobile data in the Settings if needed.
Socket answered 30/10, 2023 at 23:6 Comment(0)
V
1

my issue was that my mac is connected to my iphone personal internet, i'm not sure if that is a real issue, but disconnecting from my peronal internet and using the wifi fixed it for me

needed to restart android emulator

Vickery answered 8/11, 2023 at 3:50 Comment(0)
G
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.

Germanophobe answered 28/6, 2018 at 7:5 Comment(0)
F
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.

Felisafelise answered 21/2, 2019 at 9:30 Comment(1)
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"Decipher
T
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!

Trochlear answered 10/7, 2019 at 16:58 Comment(0)
P
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.

Phosgenite answered 5/9, 2019 at 9:48 Comment(0)
M
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

Monoacid answered 31/5, 2020 at 12:49 Comment(0)
B
0

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

this work for me

Bunghole answered 12/11, 2020 at 3:40 Comment(0)
N
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.

Norikonorina answered 27/1, 2021 at 12:33 Comment(0)
V
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.

Vole answered 31/3, 2021 at 18:32 Comment(0)
H
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.

Horne answered 29/10, 2022 at 16:35 Comment(0)
P
0

This can be resolved by setting Private DNS to google DNS 8.8.8.8

steps Include

  1. open cmd

  2. navigate to android emulator path in SDK folder

    my android emulators path is F:\android_sdk\emulator

  3. List all available emulators with emulator -list-avds

  4. Run this command to open emulator with Private DNS emulator -avd EMULATORNAME -dns-server 8.8.8.8

Pippy answered 25/9, 2023 at 5:32 Comment(0)
F
0

Got the same problem, if using the emulator command line to start the emulator, adding the option -no-snapshot-load to cold boot it resolved the issue.

emulator -list-avds    
emulator @Pixel_4_API_31 -no-snapshot-load
Foran answered 2/4 at 18:55 Comment(0)
T
0

You have to do this steps (as of 2024 April this is working)

1- Cold boot

2- Turn off WIFI

3- Long press the Mobile Data

4- Turn Data Roaming

5- Keep Mobile Data Open

finish, happy debug!

Templia answered 4/4 at 8:59 Comment(0)
A
-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.

Alys answered 25/10, 2021 at 10:59 Comment(0)
S
-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.
Semiotics answered 23/2, 2023 at 11:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.