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
2: it may be a DNS problem (in most cases, Jack note)
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
-Password: Your password if needed, or
The default address of the android simulator is 10.0.2.3, and the default DNS is 10.0.2.3. For those who study Android online at home, the IP addresses of General computers are 192.168.1.100 and not in the same network segment. 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.
My modification method:
1. Use System commands to enter the android Development Kit tools directory
Cd c: \ Program Files (x86) \ Android-SDK
2. Start the simulator in eclipse
3. Use the ADB shell to confirm the system attributes.
ADB Shell
Getprop
Getprop lists the current attributes of the system and obtains 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 219.141.136.10)
5. Then try again in the simulator to test whether the Internet can be accessed.
Note: You can use the ipcnofig/all command to confirm the DNS.
CMD -- enter the path for storing your APK,
Then install it with ADB install ??. If the APK has been installed, use ADB install-r ??. APK
For example:
Cd c: \ Users \ Xue \ downloads
ADB install sogouinput_android_3.0.20.sweb.apk