Pierre Vieira
Pierre Vieira

Reputation: 3348

How to configure proxy in emulators in new versions of Android Studio?

Problem Description

I need to configure the proxy manually in my emulator through Android Studio. From the official Android documentation, it is suggested that this change can be made in the "settings" tab of the emulator's extended controls. The problem is that it seems to me that this documentation is outdated, as this setting is no longer displayed in the "settings" tab of the Android Studio emulators' extended controls.

Documentation

with proxy

My Android Studio

without proxy

My version of Android Studio

Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
Runtime version: 11.0.11+9-b60-7590822 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: com.wakatime.intellij.plugin (13.1.10), wu.seal.tool.jsontokotlin (3.7.2), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), com.developerphil.adbidea (1.6.4), org.jetbrains.compose.desktop.ide (1.0.0), ru.adelf.idea.dotenv (2021.2), org.intellij.plugins.markdown (211.7142.37)

Upvotes: 53

Views: 27830

Answers (4)

Joe Malebe
Joe Malebe

Reputation: 714

You can add the proxy in the emulator wifi settings. Click on internet settings, select androidWifi. Click on the edit icon then add your proxy there.

Android wifi settings

Edit network settings

Proxy setup

Upvotes: 2

Jacek Marchwicki
Jacek Marchwicki

Reputation: 1683

You can go to setup proxy in Android Studio itself.

  1. Configure Proxy in the Preferences window Preferences window
    1. Go to Preferences window (Mac: cmd+, shortcut).
    2. Click Appearance & Behavior on the left panel
    3. Click System Settings on the left panel
    4. Click HTTTP Proxy on the left panel
    5. Setup your preferred proxy settings
    6. Confirm by clicking OK
  2. You need to restart emulator to apply your changes

The downside of the solution is that the proxy is also applied to Android Studio itself. So traffic from Android Studio goes through the proxy.

Upvotes: 12

Pierre Vieira
Pierre Vieira

Reputation: 3348

After a while trying to find solutions to this problem, I saw that an emulator running outside android studio provides these options. To run a standalone Android Studio emulator see the official documentation or simply enter the command:

emulator -avd <avd_name>

In my case I'm using an avd named PIXEL 4 API 30, so the command will be emulator -avd PIXEL_4_API_30. If you are on Windows you may have problems running this command so I suggest you see this.

Edit

The solution proposed by @Inliner also solves this problem.

Upvotes: 5

Inliner
Inliner

Reputation: 1659

You can open old emulator version by unchecking setting hereenter image description here

If you struggle to close your old emulator, try killing qemu... process

Upvotes: 56

Related Questions