Monkey測試:
adb shell
monkey -p com.lanto.water 10000 回車
- 1 將已經(jīng)編寫好的代碼部署到模擬器/真機(jī)
- 2 打開CMD命令,輸入命令 adb shell 切換到模擬器目錄
- 3 輸入 monkey -p 應(yīng)用程序包名 測試次數(shù) 然后回車即可 monkey -p com.lanto.water 10000 回車
- 4 測試過程中,可以按電腦鍵盤上的Ctrl +C 終止測試
adb 查看當(dāng)前展示的Activity
adb shell dumpsys activity | grep "mResumed"
//單設(shè)備
adb shell
dumpsys activity | grep "mResumed"
//多設(shè)備
//我的華為P40.
adb -s VEG5T20324000109 shell
dumpsys activity | grep "mResumed"
adb 查看APP的包名
連接打開前臺app
adb shell "dumpsys window | grep mCurrentFocus"
adb wifi調(diào)試
連接adb connect ip
adb connect
斷開adb disconnect ip
adb disconnect
查詢當(dāng)前設(shè)備所有安裝應(yīng)用包名
adb shell pm list packages
卸載apk
adb uninstall 應(yīng)用包名
adb uninstall com.lanto.water
//VOG-AL10
adb -s APH0219909019978 uninstall com.lanto.water
啟動APP
第1步:
adb shell dumpsys window windows | findstr "Current"
第2步:
adb shell am start -n 應(yīng)用包名/啟動頁完整包名
adb shell dumpsys window windows | findstr "Current"
adb shell am start -n com.liantuo.xiaojingling.newsi/com.liantuo.xiaojingling.newsi.view.activity.SplashActivity
多設(shè)備情況下安裝apk
adb -s CLB7N19212003136 install D:\ZxnWork\gitee\XiaoJingLing\apk\1.13.apk
adb -s da4dd095 install D:\ZxnWork\gitee\XiaoJingLing\apk\1.13.apk
列出當(dāng)前設(shè)備
adb devices
D:\ZxnWork\gitee\xjl_mzks>adb devices
List of devices attached
CLB7N19212003136 device
da4dd095 device
連接單個(gè)手機(jī)安裝apk
adb install -r xxxx.apk
注意:應(yīng)用名稱xxxx不能有中文
例如:安裝醫(yī)庫app
`adb install -r D:\apks\com.medicool.zhenlipai.apk`
指定設(shè)備安裝apk
//在emulator-5554模擬器上安裝ebook.apk:
adb -s emulator-5554 install ebook.apk
//在真機(jī)上安裝ebook.apk:
adb -s HT9BYL904399 install xx.apk
adb -s CLB7N19212003136 install D:\ZxnWork\gitee\xjl_mzks\app\build\outputs\apk\release\app-release.apk
顯示系統(tǒng)中全部Android平臺:
**android list targets**
終止adb服務(wù)進(jìn)程:
adb kill-server
重啟adb服務(wù)進(jìn)程:
adb start-server