Android simulator overview-updated to the latest 3.0 Honeycomb

Source: Internet
Author: User
Tags netspeed

 

This section describes how to build an android Development Environment Based on Android SDK (2.3) and eclipse (Helios) in windows, and create the first application Hello Android world, later, I used the honeycomb preview simulator to thoroughly parse the android project structure and debugging in eclipse.

For more information, see the blog: http://blog.sina.com.cn/deaboway
Or http://blog.csdn.net/deaboway
.

I,
Environment Variable

In the latest Android SDK, ADB has been removed from. /tools/directory. /platform-tools/. Therefore, in a Windows environment, you must add the preceding two directories to the path, as shown below:

II,
Common commands

In this way, we can directly run commands such as ADB, Android, and emulator in cmd. A brief introduction is as follows:

1.
Enter ADB in the command line
Related commands:

You can enter ADB in the command line and press enter, or press enter after ADB help to view the specific parameters. Here are some common commands.

ADB Devices

Lists All Mount settings.

ADB Shell

Enter the root directory/of the device to obtain control over the device, such as the LS command.

ADB install

Install the specified APK file on the device. If multiple devices exist at the same time, you must specify the target device, for example, ADB install-s emulator-5554 D:/name.apk.

ADB uninstall [-K] <software Name>

Uninstall the specified software. If the-k parameter is added, the software is uninstalled but the configuration and cache files are retained.

ADB push <local path> <remote path>

Copy the files or folders on the local computer to the device (mobile phone ). For example, we can use the following command to store items other than sdcard: ADB push gavin.txt/sdcard/gavin.txt.

ADB pull <remote path> <local path>

Copy the files or folders on the device (mobile phone) to the local computer.

2.
Command Line input android
Related commands:

For specific parameters of the android command, enter android in the command line and press enter, or press enter after Android-help. Here are some common commands.

3.
Command Line input emulator
Related commands:

You can enter emulator-help in the command line and press enter to view the specific parameters of the emulator command. Here are some common commands.

Emulator-AVD

Start the specified simulator.

Emulator-AVD-sdcard

Start a specified simulator with an SD card.

Emulator-skin

Start a simulator that uses the specified skin.

Emulator-netdelay

Simulate multiple network latency levels, so you can test your application in a more realistic environment. You can set the latency level or range when the simulator starts, or you can dynamically modify the latency during the simulator running through the console. (Operations on the console will be introduced later)

Emulator-netspeed

Simulate multiple network transmission speeds. You can specify the transmission speed or range when the simulator starts, or you can dynamically modify the transmission speed on the console after the simulator starts.

4.
Mksdcard [-l label]

Create an sdcard, for example, mksdcard 256 m c:/Gavin. img

5.
Simulator Console

Every running simulator instance includes a console. We can use the console to dynamically query and control the simulated device environment. For example, we can use the console to dynamically manage port ing and network features, and simulate telephone events. To enter the console and enter a command, use Telnet to connect to the Console Port:

Telnet localhost

Among them, port is the port number of emulator. If the first port is port 5554, the port number used by the next instance will be added with and 5558. Up to 16 simulator instances can run the console simultaneously.

The following methods are used to obtain the simulator:

L use the-verbose option when starting the simulator to detect the port number used by the simulator instance;

L find the line "emulator console running on port number" in the debugging output;

L use ADB devices in the command line to view the simulator instance and their port list.

After connecting to the console, you can enter help [command] to view the command list and the specified command tutorial. To exit the console session, run the quit or exit command. The following describes several common commands in the console.

Redir

Add and delete port redirection during simulator running. After connecting to the console, you can use it to manage port redirection: List, add, and delete ports.

Network Status

Detects network conditions, current latency, and acceleration features.

Network Delay GPRS

Same as emulator-netdelay

Network Speed

Same as emulator-netspeed

GSM

Simulate the phone function on the simulator. Simulate incoming calls and create/terminate data connections. The phone call simulation in the Android system is the same as the actual situation. This version currently does not support phone recording.

III,
Android
Simulator shortcut

 

Here is a special introduction to the latest version of the more suitable for tablet use, especially for Android tablets to optimize the system version of honeycomb preview, the use of Ctrl-F11.

On the honeycomb preview, the default display is as shown in:

If you want to display the image normally on the computer screen, you must deselect the check box in "menu"-"Settings"-"screen"-"auto-rotate screen. If the screen is still flipped while honeycomb preview is horizontal at this time, then press the Ctrl-F11 twice in a row-cut into the portrait and then switch back to the landscape-at this time, the screen will be displayed as follows:

In addition, you can select "Chinese (simplified)" in "menu"-"Settings"-"Language & input"-"Select language" to use the Chinese interface, as shown below:

For more setting information, please feel free to leave a message on the blog.

IV,
Limitations of Simulators

The simulator can basically simulate the functions of the vast majority of Android devices, but so far, the simulator still has the following restrictions:

  • Calls and calls are not supported. However, you can simulate calls (incoming and outgoing calls) on the console)
  • USB connection not supported
  • Camera/video capturing not supported
  • Audio input (capture) is not supported, but output (replay) is supported)
  • Extended headphones not supported
  • Unable to determine the connection status
  • Unable to determine battery level and AC charging status
  • Unable to determine the SD card insertion/pop-up
  • Bluetooth is not supported

V,
Run multiple simulator instances

If necessary, you can run multiple simulator instances at the same time. Each simulator instance uses independent user data memory and different Console ports. In this way, you can manage each simulator instance independently. However, the ability of each instance to store persistent user data across sessions-applications set and installed by users-is limited. The details are as follows:

L only the first simulator instance can save user data according to the session. By default, it stores user data on the development device ~ /. Android/userdata. IMG (Linux and Mac) or C:/Documents and Settings // local settings/Android/userdata. IMG (Windows) file. Use the-data option when starting the simulator to control the storage and loading location of user data.

The simulator instances started after the first instance (parallel) also save user data during the session, but they do not save it for the next session. These instances store data in temporary files. When the instance exits, the corresponding temporary files will be deleted.

VI,
Online simulator Problems

1. Write the network connection proxy settings to the configuration database

① Open the simulator through the command line or by double-clicking the emulatoer Executable File

② Execute the ADB shell in the command line to open the android Console

③ Run ls-L/data/COM. Android. providers. Settings/databases/settings. dB to check whether the system sets the database file to exist.

④ 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

⑤ Execute insert into system values (99, 'HTTP _ proxy', '2017. 168.0.245: 8080 '); statement insert data, where 192.168.0.245 is the Proxy Server IP address we want to use, 8080 is the port, please replace according to the actual situation

Run select * from system; to view the inserted data.

7. Restart the simulator to make the proxy server settings take effect.

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.

① Use system commands to enter the android Development Kit tools directory

Cd e:/Android-SDK-Windows/tools

② Use the ADB shell to confirm the system attributes

ADB Shell

Getprop

Getprop lists the current attributes of the system.

③ 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]

④ 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.

3. Start 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

For more articles, visit:

Http://blog.sina.com.cn/deaboway

Http://blog.csdn.net/deaboway

The above two blogs are synchronously updated.

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.