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
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.
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
-http-proxy http://168.192.1.2:3300
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 LinuxIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With