Set the ADT simulator to access the Internet in a proxy environment

Source: Internet
Author: User

In Windows, After configuring the adroid environment variable (such as adding D: \ android-sdk-windows-1.0_r1 \ tools to the system variable path), enter in the command line window:
Emulator
After the android simulator is started, enter:
ADB Shell
Enter the ADB shell mode:
Write the network connection proxy settings to the configuration database. If your Internet proxy IP address is 10.193.xx.xx:
Sqlite3/data/COM. android. providers. settings/databases/settings. DB "insert into system values (99, 'HTTP _ proxy', '10. 193. XX. XX: 1080 ')"
Check whether the system settings have been successfully changed:

Sqlite3/data/COM. Android. providers. Settings/databases/settings. DB "select * from System"

The result should contain 99 | http_proxy | 10.193.xx.xx: 1080.

Restart the simulator and use the Internet on browser.

How to delete the configuration information just written:
Sqlite3/data/COM. Android. providers. Settings/databases/settings. DB "delete from system where _ id = 99"
Or directly start with Parameters

Emulator-http-proxy 10.193.xx.xx: 1080
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/ericbaner/archive/2009/02/12/3881446.aspx
Then I found another method. Start the simulator and go to Settings> wireless controls> mobile networks> Access Point names.

Then open the access point that appears in the list;
Then set it as follows:
-Proxy: your proxy address
-Port: your proxy Port
-UserName: your username if needed, or <not set>
Password: Your password if needed, or <not set>
There may be DNS problems:
The default address of the android simulator is 10.0.2.3, and the default DNS is 10.0.2.3. For people who study Android online at home (like me), the IP address of the computer is 192.168.1.100, not in the same CIDR block. Therefore, the computer can access the Internet, but the simulator cannot access the Internet. In fact, it is easy to set the default DNS of the simulator to the DNS address of the computer.
Step 1: Use System commands to enter the android Development Kit tools directory
Cd x: \... \ Android-SDK-Windows \ Tool
Article 2: Use the shell of ADB to confirm the attributes of the system.
ADB Shell
Getprop
Getprop lists the current attributes of the system.
Step 3: Obtain the DNS address of the simulator.
In the result, we can see:
[Net. dns1]: [10.0.2.3]
[Net. dns2]: [10.0.2.4]
[Net. dns3]: [10.0.2.5]
[Net. dns4]: [10.0.2.6]
Step 4: Change DNS to our own DNS
Setprop net. dns1 192.168.1.1
Note: General TP-LINK and D-LINK DNS are 192.168.1.1, if not please use ipcnofig/all command to confirm.
If you use the browser of the simulator again, you will find that you can already access the internet.
1. android is upgraded to 2.3 and cannot be connected to the Internet. The reason is that GSM modem is not installed in 2.3 by default. When a new AVD simulator is generated, you can add GSM to the hardware so that the computer can access the Internet, the simulator can also access the internet.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.