1.抓log方法 (bat文件)
mkdir D:\logcat
set /p miaoshu=請描述操做:
adb logcat -v threadtime > D:\logcat\%miaoshu%_%date:~0,4%-%date:~5,2%-%date:~8,2%_%time:~0,2%-%time:~3,2%.txtshell
2.抓anr的方法:測試
adb pull data/anr/traces.txt > D:\視頻
3. 跑monkey腳本(bat文件)圖片
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 40 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.錄測試apk的視頻、截圖並導出到本地 (view.bat,screen.bat) it
::安卓截圖命令
adb shell screencap -p /sdcard/screen.png #-p以png的格式保存截圖
@ping -n 5 127.1 >nul 2>nul
::更改當前目錄爲批處理自己的目錄
cd/d "%~dp0"
::獲取當前時間
set y=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
::建立目錄
md %y%
::把圖片導出來
adb pull /sdcard/screen.png %y%
::刪除手機中所截的圖
adb shell rm -r /sdcard/screen.pngio
::安卓錄屏命令
set /p t=請輸入時間(秒):5
adb shell screenrecord --time-limit %t% /sdcard/view.mp4
@ping -n 5 127.1 >nul 2>nul
::更改當前目錄爲批處理自己的目錄
cd/d "%~dp0"
::獲取當前時間
set y=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
::新建目錄
md %y%
::把視頻導出來
adb pull /sdcard/view.mp4 %y%
::刪除手機中所錄的視頻
adb shell rm -r /sdcard/view.mp4thread
5.adb命令獲取CPU、內存PSSdate
CPU:exception
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