1. Create, delete, and browse the AVD at the command line
Manage AVD requires Android command under the Tools subdirectory in the Android SDK directory, android+ the following command
List: Lists all installed Android versions and AVD devices on the machine.
List AVD: Lists all installed Android versions on the machine.
list target; Lists all installed Android versions on the machine.
Create AVD: Creates an AVD device.
Move AVD: Move or rename an AVD device
Delete AVD: Delete an AVD device
Update AVD: Upgrade an AVD device to conform to the new SDK environment.
Create project: Creating a new Android project
.......
Eg: Create a new AVD device
Android Create avd-n <AVD name >-T <android version >-B <cpu Architecture >-P <AVD Device Save location >-s < select AVD Skin >
Where-N and-T are required, the rest is optional.
Android Create Avd-n crazyit-t 10-b armeabi-v7a
The above command 10 is the code name of android4.2.
2. Using the Android Emulator (Emulator)
Android Simulator is a "virtual phone" running on the computer, click the Start button is to launch the emulator to run the Android system
In the Android SDK installation directory under Tools Emulator and Emulator-arm, Emulator-x86.exe, are Android emulator.
Using the simulator to start the AVD
EMULATOR-AVD <avd name > Eg:emulator-avd crazyit
Emulator-data image file name
3. Use DDMS to debug
How do I debug my Android app?
DDMS Full name Dalvik debug Monitor Service, it is a powerful debugging environment.
Run Ddms.bat
Device panel: The panel in the upper-left corner of the Ddms window;
Information Output panel: The panel is located below the Ddms window.
Thread Tracking panel: This panel can be used to view the status of all executing threads within a specified process. Displays the status of the specified process thread, guaranteeing the following two steps: 1. Press the "Show thread Updates" button on the device panel and 2. Select the process you want to view on the device panel.
Heap Memory Trace panel: This panel can be used to view allocation and recycling information for the specified in-process heap memory. To display the recycle and distribution status of the specified in-process heap, ensure that: 1) on the device panel, press show heap updates;2 to select the process you want to view on the device panel.
Simulator Control Panel; File Management dialog box;
4. Usage of Android Debug Bridge (ADB)
The command is located under the Platform-tools subdirectory. The ADB tool can either replicate the emulator files with the computer files or install the APK app. You can even switch directly to the Android system to execute the Linux command.
1) View the currently running emulator
Adb-devices
2) Copying the files between the computer and the mobile phone
By default, the ADB tool always operates on the emulator that is currently running.
Copy the computer files to the emulator, using the
ADB push d:/abc.txt/sdcard/
Copy the emulator files to your computer and use the
ADB pull/sdcard/xyz.txt d:/
3) Start the shell window of the emulator
ADB shell
4) Install and uninstall APK program
APK program is a release package for Android programs.
In order to package Android apps as a release APK package, you need to go through the following 3 steps
A. Convert the. class file by using the DX tool. A. dex file is usually obtained after conversion
B. Package all resource files through the AAPT tool. Usually get a. ap_ file after packaging
C. Package the. dex,.ap_ files obtained in the first two steps with the Apkbuilder tool into an APK package.
Once packaged into an APK package, you can then install and uninstall the APK program via the ADB tool.
ADB Install APK Program
ADB install [-r] [-S] <file>
-R means that the APK package is reinstalled and-s means that the APK package is installed on the SD card and the APK package is installed on the internal storage by default. EG:ADB Install test.apk
Delete a specified package
adb uninstall [-K] <package>
-K means that only the application is deleted, but the data and cache directory of the application is preserved.
5. Using DX to compile Android apps
The command is as follows:
DX--dex [--dump-to=<file>] [--core-library] [<file>.class] <file>. {zip,jar,apk}
The above command [--dump-to=<file>] Specifies the file name of the generated. dex file, while [--core-library] specifies the. class,. zip,. jar file, or directory that you want to convert.
EG:DX--dex--dump-to=g:\a.dex--dex-library d:\helloworld\bin
Convert all binaries under the D:\helloworld\bin path to the A.dex file under the g:\ root directory.
6. Use Android Asset packaging Tool (AAPT) to package resources
When we release an APK package, some resources are essential
Syntax format
Aapt-a < Accessories resource path >-s < Resource path >-M <android application manifest file >-i < Additional package > and-f destination file path
Eg:appt-a assets-s res-m androidmanifest.xml-i D:\android-sdk-windows\platforms\android-9\atfroms\android-9\ Android.jar-f BIN\RES.AP_
The above command packages the assets subdirectories, Res subdirectories, and androidmanifest.xml files in the directory into the BIN\RES.AP_ resource bundle.
7. Using Mksdcard to manage virtual SD card
Mksdcard [-l label] <size> <file>
<size> Specify the size of the virtual SD card,<file> Specify the file image to save the virtual SD card.
Mksdcard 64M D:\avds\.android\avd\leegang.avd\sdcard.img
Specifying an SD card when you start the emulator
EMULATOR-AVD Crazyit-sdcard d:\sdcard.img
Usage of Android common development tools