Simulator 1.5: AVD creation, ADB Command Strategy

Source: Internet
Author: User

Simulator 1.5: AVD creation, ADB Command Strategy


Download the android SDK or ophonesdn from Google to download the ophonesdk. decompress the SDK and create a tool folder under the root directory of the SDK. Double-click emulator.exe to directly start the simulator.

Simulator 1.5

1. simulator appearance customization:
480x320, landscape: emulator-skin HVGA-L
320x480, portrait: emulator-skin HVGA-P (default)
320x240, landscape: emulator-skin QVGA-L
240x320, portrait: emulator-skin QVGA-P

2. Add an SD card to the simulator:
Emulator-sdcard D:/sdcard. img
Let's talk about how to create the "sdcard. IMG" file:
Another useful tool named mksdcard.exe is available in the movie toolsexample directory. You can see the name -- make sdcard. Yes, use it to create an "SD card ".
Command:
Mksdcard 512 m d:/sdcard. img
OK, so that an SD card with a capacity of 512 MB is created.
Use sdcard:
Create: mksdcard <512 m>
(Bytes (default), K, M)
Connect to the simulator: emulator-sdcard <directory/sdcard. img>
Upload the file to sdcard: ADB push <directory/myaudioworkflow>

3. The simulator's communication gphone simulator has a unique number: 15555218135, which is similar to the SIM card number of our real mobile phone.
Dialing:
1. Run cmd
2. Connection: Telnet localhost 5554
3. Command: GSM call 15555218135
The simulator displays incoming calls. The same is true for answering/hanging up calls.
Text messages are as simple as text messages. Repeat steps 1 and 2 and modify the third part of the command:
SMS send 15555218135 hello, this is a message.

ADB command
ADB (Android debug Bridge) is a common debugging tool provided by Android. With this tool, we can manage the status of devices or mobile phone simulators. You can also perform the following operations:
1. quickly update the code in a device or mobile phone simulator, such as an application or Android system upgrade;
2. Run shell commands on the device;
3. Manage the ports on the device or mobile phone simulator;
4. Copy or paste a file on the device or mobile phone Simulator

Some common operations:
Go to shell: ADB Shell

Through the above command, you can enter the shell environment of the device or simulator. In this Linux Shell, You can execute various Linux commands. In addition, if you only want to execute one shell command, you can use the following methods:
ADB shell [command]
For example, ADB shell dmesg prints the kernel debugging information.
(The Linux Shell of Android has been greatly simplified, and many common Linux commands are not supported)

Upload File: ADB push

Download file: ADB pull

Installer: ADB install <*. APK>

Uninstall software: ADB shell RM/data/APP/<*. APK>

Add that the software installed through ADB (*. APK) is in the "/data/APP/" directory, so you do not have to specify the path during installation. To uninstall the SDK, simply execute "RM.

End ADB: ADB kill-Server

Display the android simulator status:
ADB Devices)
ADB get-product (Device Model)
ADB get-serialno (serial number)

Device waiting for running: ADB wait-for-Device
Port forwarding: ADB forward TCP: 5555 TCP: 1234
(Forward the default port tcp 5555 to port 1234)

View bug report: ADB bugreport

ADB shell sqlite3 Access Database sqlite3

ADB shell logcat-B radio records wireless communication logs: Generally, there are a lot of wireless communication logs and there is no need to record them during running, but we can still set the record through the command:
Application configuration file: "androidmanifest. xml" "determines whether the application is displayed on the panel.
Am command (use am in shell to load Android applications ):
Am [Start | instrument]
Am start [-A]
[-D]
[-T]
[-C [-C]...]
[-E [-e...]
[-N] [-D] []
Am instrument [-E]
[-P]
[-W]

Start the browser:
Am start-A Android. Intent. Action. View-D http://www.google.cn/

Call number:
Am start-A Android. Intent. Action. Call-D Tel: 10086

Start Google map to go directly to Beijing:
Am start-A Android. Intent. Action. View GEO: 0, 0? Q = Beijing

Simulator directory
Directory:
# Ls
Ls
Sqlite_stmt_jou
Cache
Sdcard
Etc
Init
Init. Goldfish. r
Init. RC
Data
System
Proc
Sys
Sbin
Default. Prop
Root
Dev
The sequence of the file stream strings obtained from andorid is arranged in the order of "type + permission + owner + array + size + date + name + link, "D" indicates a folder, "L" indicates a link, and "-" indicates a file.
For example, d rwxrwx --- system cache Cache
The preceding directory is parsed by parsing the strings returned by the LS command.

Database:
Contact (including call records) Database:/data/COM. Android. providers. Contacts/databases/contacts. DB
Media repository (like recording ringtone settings):/data/COM. Android. providers. Media/Internal. DB
System settings:/data/COM. Android. providers. Settings/databases/settings. DB
SMS Library:/data/COM. Android. providers. telephony/databases/mmssms. DB
Web Settings:/data. Data/COM. Android. Settings/databases/webview. DB
Map search history:/data/COM. Google. Android. Apps. Maps/databases/search_history.db
Account library? (Contains androidid information):/data/COM. Google. Android. googleapps/databases/accounts. DB
Ringtone:/system/Media/Audio
Time zone settings:/data/property/persist. SYS. timezone

Current installation mode
Before installation:
1. emulator-wipe-Data
2. ADB push busybox ./
3. ADB shell./busybox tar-CF/tmp/data.tar/Data
4. ADB pull/tmp/data.tar.
5. mkdir original
6. CD original
7. Tar-XF ../data.tar
After installation:
1. ADB shell./busybox tar-CF/tmp/data.tar/Data
2. ADB pull/tmp/data.tar.
3. mkdir after_install
4. CD after_install
5. Tar-XF ../data.tar
Currently, two related files are added under/data/APP and data/data, and the installed program information is added to/data/system/packages. xml. It seems that the menu also shows whether the new installer is obtained from this file and how to display relevant information, such as the name or something.

Differences between Android simulators and real machines
* 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 is not supported.
* Audio input (capture) is not supported, but output (replay) is supported)
* Extended headphones are not supported
* The connection status cannot be determined.
* The battery level and AC charging status cannot be determined.
* The SD card insertion/pop-up cannot be determined.
* Bluetooth is not supported.

Note the following when using the andoroid simulator:
Users who usually use emulator for testing and development should pay attention to regularly clearing the C:/drivers and settings/SH/localsettings/temp/androidemulator folder, because the android simulator will generate several temporary files each time it runs. the temporary file with the TMP suffix takes up to 5 GB of disk space for a few months. Attackers can safely delete these files.

Tips for Simulators

Correctly start the simulator [SDK 1.5]
After JDK is installed, Enter cmd in the run box and press enter to bring up a black box. (Most of the subsequent operations are performed in this black box)

Enter CD/d:/android-sdk-windows-1.5/tools/in the black box/
(This path is the path for storing simulators. You need to enter the path based on the path you have stored)

After you enter the correct command, the path of the simulator you store is automatically displayed.

Enter Android and press Enter next to the command. A bunch of commands will pop up in the black box. It doesn't matter if you don't understand it! We can scroll through the black box to see the location of the last command.

Enter Android create AVD-T 2-N G1 after the name, and press Enter. "NOTE: The last G1 in this command can be named at will. You can write G2, Android, and gphone & #8226; & #8226; & #8226; in this step, remember that there is a space between Android, create, AVD,-T, 2,-N, and G1]

A new command will pop up! We only need to enter NO and press Enter.

After completing the preceding operations, open the file for storing the SDK simulator, right-click the simulator program, and choose "send"> "desktop shortcut ".

After returning to the desktop, I found that double-click the little green man and I still cannot open the simulator! Do not worry, right-click Properties! Add-AVD G1 to the shortcut-target path

Note again: this-the front should be blank, and the G1 followed by AVD should be consistent with the name entered in the black box in the previous step.

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.