1. 程式人生 > >Android 常用幾個adb命令

Android 常用幾個adb命令

(1)安裝apk進手機

               1.adb push D:****\KeyboardManMan.apk  system/vital-app

               2.adb install C:\Users\Administrator\Desktop\傣文輸入法.apk


 (2)將手機資料匯出到本地電腦中:
            adb pull /storage/sdcard0/.****/tempimg/1539746354759.jpg C:\Users\Mr.Yang\Desktop\tup

 

(3)檢視當前的activity

        1.adb shell dumpsys activity | findstr "mFocus"

  結果:
  mFocusedActivity: ActivityRecord{7dee184 u0 **************.activity.*******Activity t861}
  mFocusedStack=ActivityStack{3d567e9f stackId=1, 6 tasks}                                                                 mLastFocusedStack=ActivityStack{3d567e9f stackId=1, 6 tasks}
    

   2.adb shell " dumpsys activity | grep -i run"

結果:

 Running activities (most recent first):
        Run #4: ActivityRecord{2d54a214 u0 com.******/com.*******.activity.GuideActivity t897}
        Run #3: ActivityRecord{2c939c21 u0 com.tencent.mm/.ui.LauncherUI t791}
        Run #2: ActivityRecord{3949b73b u0 com.android.filemanager/.FileManagerActivity t839}
        Run #1: ActivityRecord{bc7145f u0 com.iqoo.secure/.ui.phoneoptimize.PhoneCleanActivity2 t838}
        Run #0: ActivityRecord{b4bf469 u0 com.iqoo.secure/.MainActivity t838}
    Running activities (most recent first):
        Run #0: ActivityRecord{d98b5c4 u0 com.bbk.launcher2/.Launcher t749}
ACTIVITY MANAGER RUNNING PROCESSES (dumpsys activity processes)

   3.adb shell " dumpsys activity | grep "mFoc" "

結果:

    mFocusedActivity: ActivityRecord{2d54a214 u0 com.*******/com.**********.activity.GuideActivity t897}
    mFocusedStack=ActivityStack{3d567e9f stackId=1, 5 tasks} mLastFocusedStack=ActivityStack{3d567e9f stackId=1, 5 tasks}

  4.adb shell "dumpsys activity | grep mFocusedActivity"

  結果:

  mFocusedActivity: ActivityRecord{2d54a214 u0 com.*******/com.********.activity.GuideActivity t897}

 

(4)檢視手機解析度

      adb shell wm size

     結果:

       Physical size: 1080x1920

 

(5)activity棧的顯示和活動狀態

         adb shell dumpsys activity

ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
Display #0 (activities from top to bottom):
  Stack #1:
    Task id #897(任務棧)
      TaskRecord{1ceb7ecd #897 A=com.umi.niuniu U=0 sz=1}
      Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.*********/com.*********.activity.GuideActivity }  (activity的記錄)
        Hist #0: ActivityRecord{2d54a214 u0 com.*********/com.*********.activity.GuideActivity t897}
          Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.*********/com.*********.activity.GuideActivity }
          ProcessRecord{3dc521d2 1929:com.*******/u0a282}