Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up Android emulator proxy settings

People also ask

How do I enable Internet on Android emulator?

Go to your Android\Sdk\emulator folder and open command prompt. Type emulator -list-avds to see available emulator names. Type emulator -avd name-of-your-device -netdelay none -netspeed full -dns-server 8.8. 8.8 command and press enter.


The simplest and the best way is to do the following: This has been done for Android Emulator 2.2

  1. Click on Menu
  2. Click on Settings
  3. Click on Wireless & Networks
  4. Go to Mobile Networks
  5. Go to Access Point Names
  6. Here you will Telkila Internet, click on it.
  7. In the Edit access point section, input the "proxy" and "port"
  8. Also provide the Username and Password, rest of the fields leave them blank.

-http-proxy on Android Emulator

On Run Configuration> Android Application > App > Target > Additional Emulator Command Line Options: -http-proxy http://xx.xxx.xx.xx:8080


There is a setting in Android emulator to set the proxy. enter image description here


I tried after removing http in the server name and it worked for me.

emulator -avd myavd -http-proxy 168.192.1.2:3300


This will not help for the browser, but you can also define a proxy in your code to use with a HTTP client:

// proxy
private static final String PROXY = "123.123.123.123";
// proxy host
private static final HttpHost PROXY_HOST = new HttpHost(PROXY, 8080);
HttpParams httpParameters = new BasicHttpParams();
DefaultHttpClient httpClient = new DefaultHttpClient(httpParameters);
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, PROXY_HOST);

On Android Studio:

Click on Edit Configuration under App Menu

enter image description here

  1. Go to App or Android App (as default settings)
  2. tap on Debugger
  3. Tap on LLDB startup command
  4. Tap +
  5. Add you command -http-proxy http://168.192.1.2:3300

enter image description here

that`s it.

More cool stuff if you wanna use your PC IP, use this command:

  • -http-proxy "$(ipconfig getifaddr en0)":8888 on MacOS
  • -http-proxy "$(hostname -i)":8888 on Linux