I have introduced how to configure environment variables for the android SDK in "android basics using eclipse to build an android development environment and create the first Android Project". Now it is useful, we can use these Android commands directly in the Windows Command Prompt (CMD) window to assist us in development.
1. Manage the simulator device (AVD) on the command line)
- List: list all installed Android and AVD devices on the machine.
- List AVD: list all installed AVD devices on the machine;
- List target: list all installed Android versions on the machine.
- Create AVD: Create an AVD Device
- Delete AVD: delete an AVD device.
- Update AVD: update an AVD device to conform to the new SDK environment.
- Create Project: Create a new Android Project
- Update Project: update an existing Android Project
- Create test-Project: Create a new Android test project
- Update test-Project: update an existing Android test project.
Example 1: To view all installed AVD devices on the current system, enter Android list AVD, for example:
Example 2: Create a New AVD device and run the following command:
Android create AVD-n <AVD Name>-T <SDK version>-S <AVD skin>-P <AVD storage path>
For example, Android create AVD-N 1.5-T 3-s hvga
2. Run the emulator command to start the simulator.
You can use emulator.exe to start a simulator in either of the following ways:
- Emulator-AVD <AVD Name>
- Emulator-data <Image File Name>
For example, the following command:
Emulator-AVD 2.2 // run the AVD device named 2.2 here
Emulator-data userdata-qemu // here, the AVD device runs with userdata-qemu as the image file, and the image file is located in the AVD folder directory where the AVD device is saved, for example:
3. Common ADB commands
ADB is a very powerful tool. It is located in the platform-tools subdirectory of the SDK installation directory. It can replicate the simulator files and computer files, or install the APK application, you can even directly switch to the Android system to execute Linux commands.
- ADB-devices: view the current running Simulator
- ADB push C:/123.doc/sdcard/: Copy computer files to the simulator
- ADB push/sdcard/abc.txt C:/: copy the simulator file to your computer
- ADB shell: Start the shell window of the simulator. In this case, you can directly execute the Linux Command in the shell window of the simulator.
- ADB install [-R] [-S] <File>: Install the APK file.-R indicates to reinstall the APK, and-s indicates to install the APK on the SD card, installed on the internal storage by default
- ADB uninstall [packge] [-K]: detach from the systemProgramPackage.-K indicates that only the application is deleted, but all data and cache directories of the application are retained.
If there is anything wrong with the above description, please make a brick!