Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Proxy settings for Emulator

 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://<machineName>:<port>;

Or

http://<username>:<password>@<machineName>:<port>;

How to use this ?
 
Ed Burnette
Author
Ranch Hand
Posts: 142
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[I am not sure if I recall this correctly...try this if you want to]

There is a com.android.providers.settings folder on the emulator(inside data/data/) which has a database named settings.db.In this database, there is a table called "system". You can insert a row in this table which contains details of your proxy.

I think I was able to connect to internet from the browser of my emulator after this..




 
Ed Burnette
Author
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You used to have to make the database change but in current versions the option seems to be sufficient.
 
shruthi sridhar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can follow these steps to set up proxy for emulator:

1. Connect to the emulator using the "adb shell" command (From "tools" folder of SDK)
adb shell
enter this..
# sqlite3 /data/data/com.android.providers.settings/databases/settings.db
sqlite> INSERT INTO system VALUES(99,'http_proxy','<PROXY_IP>:<PROXY_Port>');


2. Use the below command to check if the value is inserted
sqlite> SELECT * FROM system;

3. Restart the emulator and check for the browser to work.

4. An alternate if this doesnt work is, Go to Run -> Run Configurations ->Target in eclipse and enter
-http-proxy <PROXY_IP>:<PROXY_Port> in Additional emulator command line options.

 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ed Burnette wrote:You used to have to make the database change but in current versions the option seems to be sufficient.

I concur with you, Sir. Lately, I have been using the command line switch(-http -proxy) to start the emulator instances(but I think the row in the system table is still there unless I have chosen to "wipe data").

I wonder what all can be set for emulator by making an entry in system table. What is the domain set of settings!?
Is using the system table deprecated?

Thanks.
 
Ed Burnette
Author
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the system table is definitely not the recommended way to do things, and it's undocumented and subject to change with each release. That said, there are probably some interesting things in there if you find yourself bored one afternoon. Personally I'd rather take the time to read the source. Or to keep up with Android forums.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic