Android Simulator is not available for Internet problems

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/you_jinjin/article/details/7228303

Method One

First, under Windows, configure the Adroid environment variable (Win7 as an example)

1, Desktop right button-"My Computer--" Advanced system settings

2, advanced-"Environment variables-" System variables--"Path

3, add the Android SDK directory to the system variable path, such as:

Note: F:\Pro-files\android-sdk-windows\tools, add to System path

If you have F:\Pro-files\android-sdk-windows\platform-tools, add it to the system path,

Description: The latest version of the Android SDK installation, emulator commands generally in the Tools directory, the ADB command moved to the Platform-tools directory

Next, start the simulator

1. cmd (ctrl+r, start command prompt form)

2. EMULATOR-AVD avd2.1 (Launch Simulator, avd2.1 for you to install Android emulator name)

3, cmd (ctrl+r, and then start command Prompt form)

Then, write the network connection proxy settings to the configuration database

1, adb shell (Linux system to enter the simulator, after the successful launch of the simulator, this command is valid)

If your Internet proxy IP is 10.10.26.252:1080

2, write data to the database, update system settings

Sqlite3/data/data/com.android.providers.settings/databases/settings.db "INSERT into system VALUES (' Http_proxy ', '10.10.26.252:1080 ') "

3. Query the database to see if the system settings have been successfully changed:

Sqlite3/data/data/com.android.providers.settings/databases/settings.db "SELECT * from System"

Description: SQLite is the micro database used by Android phone system, you can understand it as our common access, MySQL, SQL Server and other databases

4, restart the simulator, using browser Direct Internet access

Finally, if you want to delete the database, execute the following command:

Sqlite3/data/data/com.android.providers.settings/databases/settings.db "DELETE from System WHERE _id=99"

===============================================================================

Method Two

1, reference method one, set the system variables, start the simulator

2. Enter settings->wireless controls->mobile networks->access Point Names
3. Set the following parameters:
-Proxy:your Proxy Address
-Port:your Proxy Port
-Username:your Username if needed, or <not set>

Password:your Password if needed, or <not set>

4. Set the DNS parameters:

Android Simulator The default address is 10.0.2.3, the default DNS is also 10.0.2.3, for people who study Android at home (like me), the general computer's IP is 192.168.1.100 and the like, not the same network segment. So there will be a computer can surf the internet but the simulator is not able to surf the internet situation. In fact, the setting method is very simple, as long as the default DNS of the simulator is set to the DNS address of the computer.

First step: adb shell (Linux system entering the simulator)

Step Two: Getprop (Getprop will list the current properties of the system)

Step three: Get the DNS address of the emulator

In the results you 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]

Fourth step: Change DNS to our own DNS

SetProp net.dns1 192.168.1.1 or SetProp net.dns1 192.168.0.1

Note: General Tp-link and D-Link wireless DNS are 192.168.1.1, some companies wired DNS default 192.168.0.1;

If the above two DNS is not working, please use Ipconfig/all (Windows system) or IFCONFIG-A (Linux/unix System) command to confirm.

When you're done with the emulator's browser, you can see that you're already online.

How to set up the Internet for Android simulator

Because some computers online need to set up agents to access the Internet, so simple to start the simulator, simulator is not directly connected to the Internet, and the simulator for the network is not directly set up the simulator of the Internet Agent program or a set of parts. So the extra processing is needed. After a lot of groping, only to arrive at a method.

Here are the steps to set up:

1. Start the ADB shell, which is typically under tools in the SDK directory (before 1.6), but the later versions are moved to the Platform Tools directory. This is not the case, you can generally add this directory to the system under the environment variable path, so that only in the execution of the inside or cmd input can be.
Enter the adb shell in cmd, or you can enter the ADB shell directly inside the run.

2, by running the Getprop command can get the configuration of the system, mainly to view two configurations, one is net.dns1, the other is net.gprs.http-proxy. If both of these configurations are the same as the settings on your PC's Internet connection, you don't need to set up. If it's not the same, look at the next one.

3. Set by SetProp command

Set up DNS, generally if the Internet through a router, you can set the DNS as the router's default gateway. 192.168.1.1.

SetProp net.dns1 192.168.1.1

The other is to set up the agent. As follows:

SetProp Net.gprs.http-proxy 192.168.1.1:8080

If it is another agent, also use this directive, such as
SetProp Net.gprs.http-proxy 10.81.110.1:8080

Generally through the three steps can be achieved online.

Since the recent study has not been exposed to the network, so there is no question about the Internet simulator. Yesterday, my classmates asked me to solve a remote download desktop background image of the problem, only access to the network. Surprised my simulator incredibly on the net, so on the internet, a lot of information on the Internet, the same is the four methods, I only tried a self-think the simplest way, and success, other aspects did not try, the following is my practice method:

Android Simulator The default address is 10.0.2.3, the default DNS is also 10.0.2.3, for the dorm with a small router on the Internet to learn Android (like me), the general computer IP is 192.168.1.xxx and so on, not the same network segment. So there will be a computer can surf the internet but the simulator is not able to surf the internet situation. In fact, the setting method is very simple, as long as the default DNS of the simulator is set to the DNS address of the computer.

The first step: Open the simulator you want to use;



Step Two: Enter the >ADB shell at the command prompt (the Linux system that enters the simulator, if your environment variable is already set up);

Step three: Enter Getprop after # (Getprop will list the current properties of the system);



Fourth step: The DNS address of the simulator can be seen in the results: [net.dns1]: [10.0.2.3];

Fifth step: Change DNS to our own DNS, continue to enter SetProp net.dns1 after # 192.168.1.1


Note: General Tp-link and D-Link DNS are 192.168.1.1, some DNS default 192.168.0.1;

If the above two DNS is not working, please use Ipconfig/all (Windows system) or IFCONFIG-A (Linux/unix System) command to confirm.

Sixth step: Now you can surf the Internet, if you are not at ease, you can use the Getprop command to confirm whether the DNS changed.

In addition, some versions of the emulator in the program's settings have a command of the program, this and the ADB shell function is the same, that is, you can enter the instructions to implement configuration modification and settings. The principle is the same, and the instructions are the same. You can try it, please.

Android Simulator is not available for Internet problems

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.