当前位置:网站首页>A collection of common ADB commands for app testing

A collection of common ADB commands for app testing

2022-06-11 02:31:00 Lao Xiao of Buddhism

  • Querying connected devices :adb devices

    image.png

  • Connecting device :adb connect Equipment name : port

    The port numbers of different simulator designs also do not pass , The night God is used here , The default port number of the first simulator is 62001

    image.png

    NetEase mumu The configuration file :Mumu/emulator/nemu/vms/myandrovm_vbox86/myadnrovm_vboxx86.nemu, lookup ADB_PORT value

  • disconnect :adb disconnect equipment

    image.png

  • start-up adb service :adb start-server

  • close adb service :adb kiill-server

  • Get into Android System :adb shell

    image.png

    If multiple are connected at the same time Android equipment , adopt adb -s equipment : port shell Enter the specified device

  • Upload and download files

    • Upload :adb push Local files Remote directory

    1.gif

  • download :adb pull Remote files Local directory

    1.gif

  • Install uninstall application

    • install

      • Install to default device :adb install apk file

        [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-helfPCMD-1654856516476)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/793caa633f704684926da5181c869725~tplv-k3u1fbpfcp-watermark.image?)]

      • Install to the specified device :adb -s equipment : port install apk file

      • Overlay installation :adb -r install apk file

        1.gif

    • uninstall

      • uninstall :adb uninstall Package name

        -k, Keep the configuration and cache files when uninstalling

        • Query package name :

          • Method 1:aapt dump badging apk file

            1.gif

          • Method 2:

            Get into android equipment :adb shell

            Query all installed packages :pm list packages

            image.png

            Query third-party software packages :pm list packages -3

            image.png

          • Method 3:

            stay Android The device runs the program to be queried

            Get into android equipment :adb shell

            Inquire about :dumpsys window windows | grep -i current

            1.gif

  • start-up :adb shell am start -n Package name / Main class name

  • Start the application , Get start time :adb shell am start -W -n Package name / Main class name

    [email protected] Desktop % adb shell am start -W -n com.ddnapalon.calculator.gp/com.ddnapalon.calculator.gp.ScienceFragment
    Starting: Intent { cmp=com.ddnapalon.calculator.gp/.ScienceFragment }
    Warning: Activity not started, its current task has been brought to the front
    Status: ok
    Activity: com.ddnapalon.calculator.gp/.ScienceFragment
    ThisTime: 0
    TotalTime: 0
    WaitTime: 15
    Complete
    
  • Query process :adb shell ps | grep Package name

  • Inquire about CPU Occupancy :adb shell dumpsys cpuinfo | grep Package name

  • Query memory usage :adb shell dumpsys meminfo | grep Package name

    [email protected] Desktop % adb shell dumpsys meminfo | grep com.ddnapalon.calculator.gp
        36179 kB: com.ddnapalon.calculator.gp (pid 3070 / activities)
                   36179 kB: com.ddnapalon.calculator.gp (pid 3070 / activities)
    
  • stop it :adb shell am force-stop Package name

  • Enter... At the cursor :adb shell input text Content

  • Send system key :adb shell input keyevent keycode

    keycode Related information connection :https://blog.csdn.net/francisbingo/article/details/74002478

  • Click to specify the location :adb shell input tap Abscissa Ordinate

  • Get page layout :adb shell uiautomator dump

原网站

版权声明
本文为[Lao Xiao of Buddhism]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110142590653.html