Completely solve the problem that the Android simulator can't surf the internet

Source: Internet
Author: User
Tags dns2

One:To write network connection Agent settings to the configuration database

1, through the command line or by double-clicking the Emulatoer executable file, open the simulator

2. Execute the ADB shell on the command line to open the console of Android (make sure that the environment variables are set correctly, that is, the android_sdk/tools has been added to path (Linux)/path (Windows))

3. Perform ls-l/data/data/com.android.providers.settings/databases/settings.db to see if the system settings database file exists

4, if the database file exists, the implementation of sqlite3/data/data/com.android.providers.settings/databases/ Settings.db, starting with settings.db for current scheme SQLITE3

5. Execute INSERT INTO system VALUES (http_proxy, ' 192.168.0.245:8080′ ', '); Statement to insert data, where 192.168.0.245 is the proxy server that I use ip,8080 is the port, please replace

6. Execute select * from System; To see the data you just inserted.

7, restart the simulator, so that the proxy server settings take effect

8, you can use the delete from System WHERE _id=99; Statement to remove proxy settings, or use the update system set value = ' 192.168.0.245:8070′where _id=99; To modify proxy server settings

Two:It could be a DNS problem.

1, with the system command to enter the Android development package Tools Directory

CD E:android-sdk-windows Tools

2, using the ADB's shell, to confirm the system's various attributes

ADB shell

Getprop

Getprop lists the current properties of the system

3, get the simulator's DNS address

As you can see in the results:

[NET.DNS1]: [10.0.2.3]

[Net.dns2]: [10.0.2.4]

4, to 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.


Three:Start simulator directly with parameters

Emulator @default-http-proxy 10.16.xx.xx:8080

Where default is the name of the emulator

Four:setting in the emulator

Start the simulator and then enter Settings->wireless & networks->mobile networks->access Point Names

Then open the access point that appears in the list;

Then set the following:

-Proxy:your Proxy Address

-Port:your Proxy Port

-Username:your Username if needed, or

-Password:your Password if needed, or


Android Emulator The default address is 10.0.2.3, the default DNS is also 10.0.2.3, for people who learn Android online at home, the general computer IP is 192.168.1.100 and so on, not the same network segment. So there will be a computer can surf the Internet, but the simulator can not access the situation. In fact, the setting method is very simple, as long as the emulator's default DNS set to the computer's DNS address.


First step:Access the tools directory of the Android Development Kit with system commands

CD X:\...\android-sdk-windows\tool

Second cloth:Use the ADB's shell to confirm the system's properties

ADB shell

Getprop

Getprop lists the current properties of the system


Step Three:Get the DNS address of the emulator


As you can see in the results:


[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


Note: General Tp-link and D-link DNS are 192.168.1.1, if not please use Ipcnofig/all command to confirm.


Teach you to easily solve the problem of the Android simulator can't access the Internet

1, run the Android simulator, double-click the desktop Settings icon as shown below:


Android Simulator Desktop

2, sequentially enter: "Settings"-> "Wireless controls"-> "Mobile Networks"-> "Access point Names" and then open the access point that appears in the list, If it is already set to Chinese, that is: set/wireless and network/mobile network/access point name, and enter the relevant settings: Details are as follows:

Enter: "Settings"-> "Wireless controls"-> "Mobile Networks"-> "Access point Names" and then opens the access point that appears in the list. If it is already set to Chinese, that is: set/wireless and network/mobile network/access point name.

Proxy (agent): For example: 113.12.71.76, if you are not how to set up, you can Baidu to find the Internet can use proxy IP, the best is to find domestic, faster (Baidu search "proxy IP").

Port (port): The proxy IP ports you are looking for

Username (username): not set (do not enter, put the original. Also delete)

Password (password): Not set (do not enter, put the original. Also delete)

Server (servers): Not set (do not enter, put the original. also deleted).


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.