<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      每天一個安卓測試開發小知識之 (四) ---常用的adb shell命令第二期 pm命令

      每天一個安卓測試開發小知識之 (四) ---常用的adb shell命令第二期 pm命令

      上一期我們簡單介紹了如何進入\退出 adb shell以及 adb shell 的常用命令,本期繼續介紹

      pm命令

      pm是什么,pm -> packageManager 翻譯過來就是包管理 ,該命令就是提供包的管理功能

      包是什么,在安卓系統中 一個包就是一個app,例如三方包,微信 qq等,手機自帶的包,時鐘、設置 都是一個個獨立的包

      1. 查看幫助

      adb shell pm -h
      

      在這里插入圖片描述

      2. 查看已安裝的全部包

      adb shell pm list packages 會列出包名。
      包名就是包的唯一id,例如微信的包名就是 com.tencent.mm ,一個手機中包名不能重復,即不能安裝包名相同的app
      在這里插入圖片描述

      3. 包的安裝

      adb shell pm install *** 安裝apk,** 是手機中的apk路徑
      例如安裝 app-debug.apk (安卓系統中app的后綴名是 .apk
      1. push 主機上的apk到手機中
      2. 通過 pm install安裝
      在這里插入圖片描述
      還有一種方式是 直接 adb install app-debug.apk,也能實現相同的功能
      在這里插入圖片描述
      無論是 adb install 還是 adb shell pm install 都可以加很多參數,不同的參數又不同的含義

        install [-rtfdg] [-i PACKAGE] [--user USER_ID|all|current]
             [-p INHERIT_PACKAGE] [--install-location 0/1/2]
             [--install-reason 0/1/2/3/4] [--originating-uri URI]
             [--referrer URI] [--abi ABI_NAME] [--force-sdk]
             [--preload] [--instant] [--full] [--dont-kill]
             [--enable-rollback [0/1/2]]
             [--force-uuid internal|UUID] [--pkg PACKAGE] [-S BYTES]
             [--apex] [--non-staged] [--force-non-staged]
             [--staged-ready-timeout TIMEOUT] [--ignore-dexopt-profile]
             [--dexopt-compiler-filter FILTER]
             [PATH [SPLIT...]|-]
          Install an application.  Must provide the apk data to install, either as
          file path(s) or '-' to read from stdin.  Options are:
            -R: disallow replacement of existing application
            -t: allow test packages
            -i: specify package name of installer owning the app
            -f: install application on internal flash
            -d: allow version code downgrade (debuggable packages only)
            -p: partial application install (new split on top of existing pkg)
            -g: grant all runtime permissions
            -S: size in bytes of package, required for stdin
            --user: install under the given user.
            --dont-kill: installing a new feature split, don't kill running app
            --restrict-permissions: don't whitelist restricted permissions at install
            --originating-uri: set URI where app was downloaded from
            --referrer: set URI that instigated the install of the app
            --pkg: specify expected package name of app being installed
            --abi: override the default ABI of the platform
            --instant: cause the app to be installed as an ephemeral install app
            --full: cause the app to be installed as a non-ephemeral full app
            --enable-rollback: enable rollbacks for the upgrade.
                0=restore (default), 1=wipe, 2=retain
            --rollback-impact-level: set device impact required for rollback.
                0=low (default), 1=high, 2=manual only
            --install-location: force the install location:
                0=auto, 1=internal only, 2=prefer external
            --install-reason: indicates why the app is being installed:
                0=unknown, 1=admin policy, 2=device restore,
                3=device setup, 4=user request
            --update-ownership: request the update ownership enforcement
            --force-uuid: force install on to disk volume with given UUID
            --apex: install an .apex file, not an .apk
            --non-staged: explicitly set this installation to be non-staged.
                This flag is only useful for APEX installs that are implicitly
                assumed to be staged.
            --force-non-staged: force the installation to run under a non-staged
                session, which may complete without requiring a reboot. This will
                force a rebootless update even for APEXes that don't support it
            --staged-ready-timeout: By default, staged sessions wait 60000
                milliseconds for pre-reboot verification to complete when
                performing staged install. This flag is used to alter the waiting
                time. You can skip the waiting time by specifying a TIMEOUT of '0'
            --ignore-dexopt-profile: if set, all profiles are ignored by dexopt
                during the installation, including the profile in the DM file and
                the profile embedded in the APK file. If an invalid profile is
                provided during installation, no warning will be reported by `adb
                install`.
                This option does not affect later dexopt operations (e.g.,
                background dexopt and manual `pm compile` invocations).
            --dexopt-compiler-filter: the target compiler filter for dexopt during
                the installation. The filter actually used may be different.
                Valid values: one of the values documented in
                https://source.android.com/docs/core/runtime/configure#compiler_filters
                or 'skip'
            --disable-auto-install-dependencies: if set, any missing shared
                library dependencies will not be auto-installed
      
      

      -R 允許重復安裝
      -t 允許安裝測試包
      -d 允許降級安裝
      -g 安裝時直接授予app全部運行時權限
      等等參數,這里只介紹一些常用的參數
      例如 :
      在這里插入圖片描述

      4. 包的卸載

      adb shell pm uninstall packageName 或者 adb uninstall packageName packageName 是包名
      在這里插入圖片描述

      4.1 包名如何獲取

      如果是自己開發的app,包名肯定已知,如果是其他的app呢

      方式一:通過手機上的界面去查看包名
      方式二:通過aapt命令查看 適用于在主機上查看apk的信息
      方式三: 通過adb命令查看 適用于手機上查看apk信息

      • 方式一,以小米手機為例,長按app圖表 - > 點擊感嘆號 -> 點擊右上角三個點->點擊應用詳情
        在這里插入圖片描述
      • 方式二: 通過aapt

      aapt 是一個安卓提供的一個工具,aapt2下載鏈接 aapt2簡介 可以用來獲取apk的詳細信息

      以linux為例 直接在aapt的目錄中運行 ./aapt2 則會看到aapt命令的幫助信息

      • 查看apk信息 ./aapt dump badging ~/app-debug.apk~/app-debug.apk apk的保存路徑
        在這里插入圖片描述
        可以看到 包名是 com.miui.sysopt 當前的版本號 569 以及 sdk版本聲明的權限等等
      • 方式三 通過adb命令查看包名

      當我們打開某個app時,以設置為例,我們可以通過adb命令獲取當前界面上是哪個app,從而得到app的包名

      對應的adb命令是 adb shell dumpsys activity activities | grep mFocusedApp=ActivityRecord
      在這里插入圖片描述
      通過以上命令可以得到當前的app是 com.android.settings 并且可以看到當前的 activity是 com.android.settings/.MainSettings

      本期的分享先到這里,每天進步一點點!!!

      posted @ 2025-09-02 21:41  王喵喵喵  閱讀(130)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 久久中文字幕一区二区| 一二三四中文字幕日韩乱码| 国产福利高颜值在线观看| 色成人精品免费视频| 亚洲国产成人字幕久久| 夜夜添无码一区二区三区| 亚洲国产欧美在线观看| 蜜臀精品视频一区二区三区| 67194熟妇在线观看线路| 国产精品av中文字幕| 色成人精品免费视频| 亚洲精品成人7777在线观看 | 人妻丰满熟妇av无码区| 国产精品啪| 国内精品久久久久影视| 久热在线中文字幕色999舞| 国产视频有码字幕一区二区| 亚洲国产成人无码电影| 四虎成人精品永久网站| 国产福利视频区一区二区| 日本视频精品一区二区| 精品少妇后入一区二区三区| 久治县| 欧美性色黄大片www喷水| 亚洲精品日韩在线观看| 给我免费观看片在线| 国产精品一区二区三区日韩| 99精品全国免费观看视频| 国内揄拍国内精品人妻久久| 丁香五月亚洲综合在线国内自拍| 啊轻点灬大JI巴太粗太长了欧美 | 国产女人和拘做受视频免费| 国产午夜福利不卡在线观看| 欧美丰满熟妇bbbbbb| 欧美怡春院一区二区三区| 国产台湾黄色av一区二区| 亚洲日本韩国欧美云霸高清| 国产成人一区二区免av| 成人免费无遮挡在线播放| 丁香五月亚洲综合在线国内自拍| 另类专区一区二区三区|