启动app
- adb shell am start -n 包名/界面名
获取app的启动时长
- adb shell am start -W 包名/界面名
要启动一个app 就需要知道其包名与界面名,提前打开一个程序,然后执行以下程序
C:\Users\i5ba0>adb shell dumpsys window windows | findstr mFocusedApp
mFocusedApp=AppWindowToken{1db96c05 token=Token{2264db7c ActivityRecord{859126f u0 cn.goapk.market/com.anzhi.market.ui.MainActivity t4}}}
C:\Users\i5ba0>
包名/界面名:cn.goapk.market/com.anzhi.market.ui.MainActivity t4
启动app
C:\Users\i5ba0>adb shell am start -n cn.goapk.market/com.anzhi.market.ui.MainActivity t4
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] pkg=t4 cmp=cn.goapk.market/com.anzhi.market.ui.MainActivity }
C:\Users\i5ba0>
查看其启动时间时间
C:\Users\i5ba0>adb shell am start -W cn.goapk.market/com.anzhi.market.ui.MainActivity t4
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=cn.goapk.market/com.anzhi.market.ui.MainActivity }
Warning: Activity not started, its current task has been brought to the front
Status: ok
Activity: cn.goapk.market/com.anzhi.market.ui.MainActivity
ThisTime: 0
TotalTime: 0
WaitTime: 2
Complete
C:\Users\i5ba0>