Adb shell 命令整理

以Root權(quán)限運(yùn)行

adb root

重啟設(shè)備

adb reboot

重啟到Recovery

adb reboot recovery

重啟到Fastboot

adb reboot bootloader

查看設(shè)備列表

adb devices

截屏

adb shell screencap -p /sdcard/screenshot.png

錄屏

adb shell screenrecord /sdcard/screenrecord.mp4

拉取文件到電腦

adb pull /sdcard/screenshot.png ~/Documents

推送文件到手機(jī)

adb push android_server /data/local/tmp

端口轉(zhuǎn)發(fā)

adb forward [(遠(yuǎn)程端)協(xié)議:端口號(hào) ] [(設(shè)備端)協(xié)議:端口號(hào)]

查看日志信息

adb logcat [|grep filter]

查看設(shè)備ip地址

adb shell netcfg

查看設(shè)備端口信息

adb shell netstat

查看設(shè)備中可被調(diào)試應(yīng)用

adb jdwp

掛載System?

adb remount

查看CPU消耗情況

adb shell top

查看系統(tǒng)屬性

adb shell getprop 屬性值? (如查看CPU架構(gòu):ro.product.cpu.abi)

打開應(yīng)用Activity

adb shell am start com.xx.xxxx/.XXActivity

以調(diào)試模式打開應(yīng)用

adb shell am start -D -n com.xx.xxxx/.MainActivity

殺死指定包名進(jìn)程

adb shell am force-stop com.xx.xxxx

啟動(dòng)服務(wù)

adb shell am startservice -n com.xx.xxx/com.xx.xxxx.xxservice

發(fā)送廣播

adb shell am?broadcast -a action datas (action:廣播動(dòng)作,datas:攜帶的數(shù)據(jù))

查看指定包名的進(jìn)程信息

adb shell ps | grep com.xx.xxxx

安裝應(yīng)用

adb install -r app.apk

卸載指定包名應(yīng)用

adb uninstall com.xx.xxxx

查看應(yīng)用列表

adb shell pm list package

清除指定包名應(yīng)用信息

adb shell pm clear com.xx.xxxx

查看當(dāng)前Activity

adb shell dumpsys window w | grep name=""

查看當(dāng)前交互Activity

adb shell dumpsys activity | grep "mFocusedActivity"

查看activities棧

adb shell dumpsys activity activities

查看活動(dòng)Activity

adb shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p'

查看當(dāng)前應(yīng)用Activity信息

adb shell dumpsys activity top

查看指定包名的應(yīng)用信息(AndroidManifest.xml)

adb shell dumpsys package com.xx.xxxx

查看指定進(jìn)程名或者進(jìn)程ID的應(yīng)用內(nèi)存信息

adb shell dumpsys meminfo [com.xx.xxxx|pid]

查看指定包名的應(yīng)用的數(shù)據(jù)庫(kù)信息

adb shell dumpsys dbinfo com.xx.xxxx

輸入文本內(nèi)容(中文不行)

adb shell input text xxxxxxx

刪除輸入框內(nèi)容

adb shell input keyevent 67

模擬按鍵

adb shell input keyevent 鍵值(相應(yīng)鍵值請(qǐng)自個(gè)查找)

模擬點(diǎn)擊

adb shell input tap x y (x橫坐標(biāo),y縱坐標(biāo))

模擬滑動(dòng)

adb shell input touchscreen swipe startX startY endX endY

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容