First, ADB Introduction
ADB is all called Androiddebug Bridge, is the role of the Debug Bridge, ADB is a tool in the ANDROIDSDK, using this tool can directly operate the management of Android simulator or real Android device.
1. ADBinstallation
Unzip the android-sdk-windows.7z, create a new system variable Android_home d:\android-sdk-windows,path add%android_home%\platform-tools.Confirm Installation:
Enter ADB version on the console, as shown below, to indicate that it is installed correctly.
2. Common commands for ADB
adb HelpShow all supported commands and descriptions
ADB devicesDisplays the currently connected Android device/virtual machine. If the cable is connected and the device is not displayed, you need to turn on the phone's debug mode.
adbinstall [PATH]Install APKadb install–r [PATH]Overwrite Install apk
adb Uninstall [package_name]Used to uninstall APK
Note: Get Package_name method/command See ls data/data
adb logcat View Log adb logcat–c all logs before emptying
Note: The use of adblogcat is similar to the debugging functions of Java IDE, can print the operation of the device in real time, such as app Crash/exception, show the cause of crash, such as null pointer, parameter error, subscript out of bounds, etc.
adb Logcat | [Findstr/grep] [FILTER]Message filtering
Windows:findstr Linux:grep
Note: Use CTRL + C to eject the log state
adb remountTurn on device read and write permissions
Note: You need to use this command before using the Push/pull command
adb push [Local_path][remote_path] copies this computer file to the device
adb pull [Remote_path] [Local_path]
copy device files to this computer
the adb shell logs on to the device's shell and can then execute the shell command
? Examples of common shell commandsls data/data | grep [NAME]Get the package name, and if you don't know the approximate name of the package, get all the package names directly with LS Data/data
Top | grep [Package_name]Get App CPU Memory usage
Addadb–s [Device_name] [...]When a computer is connected to more than one device, the ADB command specifies the device
Second,Monkey IntroductionMonkey is a command-line tool in Android that can be run in the emulator or in the actual device. It sends pseudo-random user event streams (such as key input, touch input, gesture input, etc.) to the system, enabling stress testing of the application under development. Monkey testing is a fast and effective method to test the stability and robustness of the software.
1. Monkey installationis integrated in the above ADB.
mOnKeyCommon Parameters
-p Specifies the package name (all commands are executed within this package and, if not specified, executed within the entire system)
-V Log verbosity (maximum support for '-v-v-V ' most detailed)
-S seed (after the seed is specified, the same command executes in the same order at any time and place)
--throttle single-step delay (per operation interval, in milliseconds)
--kill-process-after-error Kill Process when error occurs
--ignore-timeouts Ignore timeout errors
--ignore-security-exceptions Ignoring license errors
Example:
adb shell monkey-p com.motk-v-v-v-S--throttle +
Specifies that the package name is COM.MOTK, the log is of the highest detail, the seed is 12, the step interval is 500ms, and the total is 1000 steps.
Note: After adding the-s command, in order to ensure that the subsequent same command to obtain the same result, before executing the command, the device must be the same status (Login app, and stay in the main interface)
adb command and Monkey stress test