I. Write the network connection proxy settings to the configuration database
1. Use the command line or double-click the emulatoer executable file to open the simulator.
2. Run ADB shell on the command line to open the android Console (ensure that the environment variables are correctly set, that is, android_sdk/tools has been added to path (Linux)/path (Windows ))
3. Run ls-L/data/COM. Android. providers. Settings/databases/settings. dB to check whether the system sets the database file to exist.
4. If the database file exists, run sqlite3/data/COM. Android. providers. Settings/databases/settings. dB to start sqlite3 with settings. dB as the current scheme
5. Execute insert into system values (99, 'HTTP _ proxy', '2017. 168.0.245: 8080 '); insert data in the statement. 192.168.0.245 indicates the Proxy Server IP address and 8080 indicates the port. Replace the value
6. Run select * from system; to view the inserted data.
7. Restart the simulator to make the proxy server settings take effect.
8. You can use the delete from system where _ id = 99; statement to delete the proxy settings, or use the update system set value = '100. 168.0.245: 8070 'Where _ id = 99; to modify the proxy server settings
Ii. DNS Problems
1. Use System commands to enter the android Development Kit tools directory
Cd e: \ Android-SDK-Windows \ tools
2. Use the ADB shell to confirm the system attributes.
ADB Shell
Getprop
Getprop lists the current attributes of the system.
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]
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.
Iii. Launch the simulator directly with Parameters
Emulator @ default-http-proxy 10.16.xx.xx: 8080
Default indicates the name of the simulator.
4. Set in the simulator
Start the simulator and go to Settings> wireless & networks> 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>
From: http://hi.baidu.com/hbzha/blog/item/797b41cdea9d390400e92865.html