Android emulator
internet connectivity issue
troubleshooting
emulator network settings
Android development

Android emulator not able to access the internet

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

When an Android emulator cannot reach the internet, the problem is usually one of four things: the host machine has a network or VPN issue, the emulator is misconfigured, DNS resolution is failing, or the app is trying to reach the wrong address. The fastest way to fix it is to separate those cases instead of changing random settings inside Android Studio.

Start by Confirming What Is Actually Broken

There is a big difference between:

  • the emulator cannot reach any public site
  • the emulator can browse the web but your app cannot hit an API
  • the emulator can reach the internet but cannot reach your local machine

Test from inside the emulator first. Open the browser and try a public site. If you want a shell check, use adb:

bash
adb shell ping -c 1 8.8.8.8
adb shell ping -c 1 google.com

If 8.8.8.8 works but google.com fails, the network path is fine and DNS is the problem. If both fail, the emulator or host network is blocked more broadly.

Remember That localhost Is Not Your Computer

This is one of the most common emulator networking mistakes. Inside the Android emulator:

  • localhost means the emulator itself
  • 10.0.2.2 means the host machine running the emulator

So if your app is calling a backend on your laptop and the code uses http://localhost:8080, it will fail from the emulator even though the internet works.

Use:

text
http://10.0.2.2:8080

instead.

That is not an internet outage. It is just the wrong address.

Check the Host Machine Before Tuning the Emulator

The emulator uses the host network stack. If the host machine is offline, behind a restrictive firewall, or trapped behind a VPN that blocks virtual interfaces, the emulator inherits the problem.

Common host-side causes are:

  • corporate VPN software filtering local virtual adapters
  • firewall or antivirus blocking adb or emulator traffic
  • DNS issues on the host machine itself
  • hotel, campus, or captive-portal Wi-Fi that the emulator has not effectively inherited

If the host browser cannot reach the internet reliably, fix that first. If the host works but the emulator does not, temporarily disable VPN or firewall filtering and retest.

Reset the Emulator Networking State

Emulators do get into bad network states. A cold boot is often enough.

Try these in order:

  1. close the emulator
  2. in Device Manager, choose Cold Boot Now
  3. if that fails, choose Wipe Data
  4. restart adb
bash
adb kill-server
adb start-server

If you use snapshots, a bad saved state can preserve broken networking across launches. A cold boot clears that kind of stale state much more reliably than just reopening the window.

Fix Proxy and DNS Problems Explicitly

If your machine uses a proxy, the emulator may need the same proxy. You can configure that in Android Studio or with adb.

bash
adb shell settings put global http_proxy proxy.example.com:8080

To clear it later:

bash
adb shell settings put global http_proxy :0

For DNS issues, inspect what Android sees:

bash
adb shell getprop | grep dns

If DNS is consistently broken, launching the emulator with explicit DNS servers can help. The emulator also tends to behave better once the host DNS issue is fixed, because it is usually inheriting from the host rather than inventing its own resolver setup.

Check App-Level Requirements Too

Sometimes the emulator has internet, but the app still fails because of Android networking policy.

Examples:

  • cleartext HTTP is blocked on newer Android versions unless allowed
  • the app has a bad base URL for debug builds
  • certificate or TLS failures are being mistaken for connectivity failures

If your requests are plain HTTP, review the network security config or switch to HTTPS. If only one API call fails while Chrome works inside the emulator, the problem is probably in app configuration rather than emulator networking.

Common Pitfalls

  • Using localhost instead of 10.0.2.2 for services running on the host machine.
  • Treating DNS failure as total internet failure.
  • Editing random files inside the emulator instead of checking host networking first.
  • Forgetting that VPN and firewall software on the host can block emulator traffic.
  • Assuming the emulator is offline when the real problem is Android cleartext or TLS policy.
  • Reusing a bad snapshot state instead of cold-booting the device.

Summary

  • First decide whether the problem is internet access, DNS, or access to a local backend.
  • Use 10.0.2.2 to reach services on the host machine from the emulator.
  • Check the host network, VPN, and firewall before changing emulator settings.
  • Cold boot the emulator and restart adb when the virtual network state looks stale.
  • Fix proxy, DNS, or app-level network policy only after you know which layer is failing.

Course illustration
Course illustration

All Rights Reserved.