1. Capture the Log method (BAT file)
mkdir D:\logcat
set/p miaoshu= Please describe the operation:
ADB logcat-v threadtime > D:\logcat\%miaoshu%_%date:~0,4%-%date:~5,2%-%date:~8,2%_%time:~0,2%-%time:~3,2%.txt
2. How to catch the ANR:
ADB pull Data/anr/traces.txt > D:\
3. Run Monkey Script (BAT file)
Set begintimes=1500
adb shell monkey-p com.jd.smart.fridge.launcher-p--ignore-crashes--ignore-timeouts--ignore-security-exceptions-- Ignore-native-crashes--monitor-native-crashes-v-v-v--throttle%begintimes% 100000 > D:\monkey_01.txt
Ping-n 127.0>nul
adb shell monkey-p com.jd.smart.fridge.launcher-p--ignore-crashes--ignore-timeouts--ignore-security-exceptions-- Ignore-native-crashes--monitor-native-crashes-v-v-v--throttle%begintimes% 100000 >> D:\monkey_01.txt
4. Record the video of the APK and export it to local (View.bat,screen.bat)
:: Android Command
adb shell screencap-p/sdcard/screen.png #-p is saved in PNG format
@ping-N 5 127.1 >nul 2>nul
:: Change the directory of the current directory to the batch itself
cd/d "%~dp0"
:: Gets the current time
Set y=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
:: Creating a Directory
MD%y%
:: Export the image to
ADB pull/sdcard/screen.png%y%
:: Delete the image cut from the phone
ADB Shell Rm-r/sdcard/screen.png
:: Du recorder screen command
set/p t= Please enter time (seconds): 5
adb shell Screenrecord--time-limit%t%/sdcard/view.mp4
@ping-N 5 127.1 >nul 2>nul
:: Change the directory of the current directory to the batch itself
cd/d "%~dp0"
:: Gets the current time
Set y=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
:: New Directory
MD%y%
:: Export the video to
ADB pull/sdcard/view.mp4%y%
:: Delete videos recorded on your phone
ADB Shell Rm-r/sdcard/view.mp4
5.ADB command gets CPU, memory pss
Cpu:
ADB shell top-m 5 > D:/cpu.txt
Pss:
Set Process=com.jd.smart.fridge.launcher
adb shell Dumpsys meminfo%process% | Findstr "Pss"
: M
adb shell Dumpsys meminfo%process% | Findstr "Total" >> d:/pss.txt
Ping-n 5 127.0.0.1>nul
Goto m
Code notes in work--adb command Chapter