ADB 命令

獲取當(dāng)前activity的名字

adb shell dumpsys activity | findstr "mFocusedActivity"

啟動(dòng)activity

adb shell am start -n {包(package)名}/{包名}.{活動(dòng)(activity)名稱}

例子:adb shell am start -n com.test.hello/.MainActivity

啟動(dòng)apk ? ?

adb shell am start com.test.hello

強(qiáng)制停止

adb shell am force-stop com.test.hello

清除緩存

adb shell pm clear com.test.hello

卸載apk(適用于/data/app 下的,一般用戶安裝的都在這個(gè)下面)

adb uninstall com.test.hello

卸載apk(適用于/system/app 下面,系統(tǒng)預(yù)裝的app.需要root 權(quán)限或者是手機(jī)的eng 版本)

1 adb remount

2 rm /system/app/com.test.hello

安裝

adb install com.test.hello

強(qiáng)制安裝

com.test.hello


模擬按鍵輸入

adb shell input keyevent 4

在屏幕上做劃屏操作,前四個(gè)數(shù)為坐標(biāo)點(diǎn),后面是滑動(dòng)的時(shí)間(單位毫秒)

adb shell input swipe 50 250 250 250 500

在屏幕上點(diǎn)擊坐標(biāo)點(diǎn)x=50? y=250的位置。

adb shell input tap 50 250

輸入字符abc

adb shell input text abc

更多模擬輸入?

http://blog.csdn.net/jlminghui/article/details/39268419


抓取log

adb shell ?logcat -v threadtime | grep? xxx

或者是輸入到文件

adb shell? logcat -v threadtime > d:/1.txt

獲取bugreport (包括內(nèi)存分配,cpu使用情況,按鍵分發(fā),組件狀態(tài),虛擬內(nèi)存狀態(tài))

adb shell bugreport > d:/1.txt

獲取traces?

adb pull /data/anr/traces.txt?


adb 遠(yuǎn)程調(diào)試

1 adb tcpip 5555

2 adb connect ip.5555

斷開遠(yuǎn)程調(diào)試

adb disconnect

查看設(shè)備

adb devices

多個(gè)設(shè)備連接時(shí)指定設(shè)備 ?設(shè)備ID從上一個(gè)命令得來(lái)。

adb -s 設(shè)備ID shell

實(shí)際上所有的的adb 命令都可以通過(guò) -s 設(shè)備ID 的方式訪問(wèn)多個(gè)設(shè)備連接時(shí)的指定設(shè)備。

最后編輯于
?著作權(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)容