Proxy which requires authentication with Android Emulator

AndroidAuthenticationProxyAndroid Emulator

Android Problem Overview


Has anybody managed to get the Android Emulator working behind a proxy that requires authentication?

I've tried setting the -http-proxy argument to

http://DOMAIN/USERNAME:PASSWORD@IP:PORT

but am having no success.

I've tried following the docs to no avail. I've also tried the -verbose-proxy setting but this no longer seems to exist.

Any pointers?

Android Solutions


Solution 1 - Android

I Managed to do it in the Adndroid 2.2 Emulator.

Go to "Settings" -> "Wireless & Networks" -> "Mobile Networks" -> "Access Point Names" -> "Telkila"

Over there set the proxy host name in the property "Proxy" and the Proxy port in the property "Port"

Solution 2 - Android

It seems like SDK 1.5 onwards, the -http-proxy flag also doesn't work. What did work for me is to boot the android image in the emulator and then once Android is running, go to Home > Menu > Settings > Wireless Controls > Mobile Networks > Access Point Names and then setup the http proxy settings for the default access point.

With the APN proxy settings in place, I can get the emulator's browser to surf the web. However, other stuff like Maps still doesn't work.

Solution 3 - Android

I remember having the same problem - After searching on the web, I found this solution - From the command line,

1. > adb shell
2. # sqlite3 /data/data/com.android.providers.settings/databases/settings.db
3. sqlite> INSERT INTO system VALUES(99,’http_proxy', 'proxy:port');
4. sqlite>.exit

EDIT: Edited answer to reflect the latest version of Android.

Solution 4 - Android

Apparently this problems runs only with Android 2.x and Windows. There is a opened bug here : http://code.google.com/p/android/issues/detail?id=5508&q=emulator%20proxy&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

Solution 5 - Android

  1. Find the file androidtool.cfg at C:\Documents and Settings\YOUR USER NAME\.android\

  2. Add this line:

     http.proxyLogin=USER@PASSWORD
    
  3. Save the file and try to open the Android SDK.

Solution 6 - Android

For setting proxy server we need to set APNS setting. To do this:

  • Go to Setting
  • Go to wireless and networks
  • Go to mobile networks
  • Go to access point names. Use menu to add new apns
  • Set Proxy = localhost
  • Set Port = port that you are using to make proxy server, in my case it is 8989

For setting Name and apn here is the link:

According to your sim card you can see the table

Solution 7 - Android

This worked for me: http://code.google.com/p/android/issues/detail?id=5508#c39<br /> Apparently there's a bug in the emulator that forces you to use the IP address of the proxy instead of the name...

Solution 8 - Android

Jay, though that would be the ideal place for this information, it has not been updated for 2.1. Below I will list the methods that currently do NOT work for the 2.1 emulator.

The http-post argument does not work for the 2.1 emulator. Setting a proxy in the APN list within the 2.1 emulator does not work. Inserting the proxy directly into the system table via sql-lite does not work with 2.1.

In fact, the ONLY way to get the browser to connect to the internet via the emulator that I've found in 2.1, is to NOT use a proxy at all. I really hope this gets fixed soon, for there are many people with this same problem.

Solution 9 - Android

  1. Start command prompt.

  2. Go the folder where your emulator is located. In general, it will be in the tools folder of the Android SDK.

  3. Then use the following command:

     emulator -avd <avd name> -http-proxy <server>:<proxy>
    

By using this, we will be able to access the internet using the browser.

Solution 10 - Android

Using Android SDK 1.5 emulator with proxy in Eclipse 3.45

Go to Package Explorer -> Right click your Android project ->Run As->Run Configurations.

Under Android Application on the left column, select your project -> on the right column, where you see Android | Target | Common tabs ->

Select Target -> on the bottom “Additional Emulator Command Line Options”->

-http-proxy http://www.gateProxy.com:1080 -debug-proxy http://www.gateProxy.com:1080

->Run/Close.

Solution 11 - Android

I've not used the Android Emulator but I have set the $http_proxy environment variable for perl and wget and a few cygwin tools on windows. That might work for you for android, but the slash in the domain name seems like a potential problem. I know I tried having my domain "GLOBAL" in there, but ended up taking it out and sticking with: http://$USER:[email protected]:80

One problem I run into a lot though is programs that cannot be told to use the proxy for DNS queries too. In cases where they don't I always get a host name not found. I'd like to find a local dns resolver that can use the proxy for all the programs that won't.

Solution 12 - Android

I was able to view the traffic with an HTTP sniffer instead of a proxy. I used HTTPScoop, which is a nice little app.

Also the nice thing about using HTTPScoop is that I can also see traffic on my actual device when I turn on internet sharing and have my phone use the wifi from my mac. So this is a good deal for debugging what happens on the phone itself AND the emulator.

This way it doesn't matter what emulator you use, because the sniffer sees the traffic independent of the emulator, device, compiler settings etc.

Solution 13 - Android

I will explain all the steps:

  1. Go to settings in Android emulator > Wireless & Network > Mobile network > Access point > Telkilla > and here do necessary settings such as proxy, port, etc.

I think now everything is clear about proxy settings...

Solution 14 - Android

For Android2.3.3 Settings->Wireless&Networks->MobileNetworks->AccessPointNames->Telkila-> set the Proxy and the Port here (xx.xx.xx.xx and port)

Solution 15 - Android

I had the same problem when i use the following command:

emulator-x86.exe -http-proxy domain\user:password@proxyIP:port -avd MyAVD

I got the proxy authentication error.

Finally, I had to bypass the proxy NTLM authentication by using the Cntlm here:

http://sourceforge.net/projects/cntlm/

And then after simply configuring the cntlm.ini, I use the following command instead:

emulator-x86.exe -http-proxy 127.0.0.1:3128 -avd MyAVD

and it works :)

Solution 16 - Android

With the new versions of Android Studio and it's emulator it is an easy task.

Press emulator's "More" button, choose Settings -> Proxy tab. All the needed configurations are there.

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRich LawrenceView Question on Stackoverflow
Solution 1 - AndroidSandeep SinghView Answer on Stackoverflow
Solution 2 - AndroidDeepak SardaView Answer on Stackoverflow
Solution 3 - AndroidNaseerView Answer on Stackoverflow
Solution 4 - AndroidarnoufView Answer on Stackoverflow
Solution 5 - AndroidTaranttiniView Answer on Stackoverflow
Solution 6 - Androiduser1541029View Answer on Stackoverflow
Solution 7 - AndroidGlenn85View Answer on Stackoverflow
Solution 8 - Androiduser280818View Answer on Stackoverflow
Solution 9 - AndroidprasadView Answer on Stackoverflow
Solution 10 - AndroidbinduView Answer on Stackoverflow
Solution 11 - AndroiddlamblinView Answer on Stackoverflow
Solution 12 - Androidb-ryceView Answer on Stackoverflow
Solution 13 - AndroidSundaramView Answer on Stackoverflow
Solution 14 - AndroidbinduView Answer on Stackoverflow
Solution 15 - AndroidShahyad SharghiView Answer on Stackoverflow
Solution 16 - AndroidGaketView Answer on Stackoverflow