adb shell 命令之----pm

常用的用法:

查看已经安装的包: pm list packages

查看已经安装的包以及apk路径(-3:只看第三方应用; -s:只看系统应用)

-f: see their associated file.
-d: filter to only show disbled packages.
-e: filter to only show enabled packages.
-s: filter to only show system packages.
-3: filter to only show third party packages.

pm list packages -f -3:列出指定包名的APK位置

pm path com.kp.poi :删除某个应用的所有数据(相当于全新安装)

pm clear com.UCMobile:禁用/启用某个应用(disable/enable)

pm disable com.android.systemui:列出硬件信息:pm list features

完整的用法:

C:\Users\Administrator>adb shell pm

usage: pm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [--user USER_ID] [FILTER]

pm list permission-groups

pm list permissions [-g] [-f] [-d] [-u] [GROUP]

pm list instrumentation [-f] [TARGET-PACKAGE]

pm list features

pm list libraries

pm list users

pm path PACKAGE

pm dump PACKAGE

pm install [-lrtsfd] [-i PACKAGE] [--user USER_ID] [PATH]

pm install-create [-lrtsfdp] [-i PACKAGE] [-S BYTES]

[--install-location 0/1/2]

[--force-uuid internal|UUID]

pm install-write [-S BYTES] SESSION_ID SPLIT_NAME [PATH]

pm install-commit SESSION_ID

pm install-abandon SESSION_ID

pm uninstall [-k] [--user USER_ID] PACKAGE

pm set-installer PACKAGE INSTALLER

pm move-package PACKAGE [internal|UUID]

pm move-primary-storage [internal|UUID]

pm clear [--user USER_ID] PACKAGE

pm enable [--user USER_ID] PACKAGE_OR_COMPONENT

pm disable [--user USER_ID] PACKAGE_OR_COMPONENT

pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT

pm disable-until-used [--user USER_ID] PACKAGE_OR_COMPONENT

pm hide [--user USER_ID] PACKAGE_OR_COMPONENT

pm unhide [--user USER_ID] PACKAGE_OR_COMPONENT

pm grant [--user USER_ID] PACKAGE PERMISSION

pm revoke [--user USER_ID] PACKAGE PERMISSION

pm reset-permissions

pm set-app-link [--user USER_ID] PACKAGE {always|ask|never|undefined}

pm get-app-link [--user USER_ID] PACKAGE

pm set-install-location [0/auto] [1/internal] [2/external]

pm get-install-location

pm set-permission-enforced PERMISSION [true|false]

pm trim-caches DESIRED_FREE_SPACE [internal|UUID]

pm create-user [--profileOf USER_ID] [--managed] USER_NAME

pm remove-user USER_ID

pm get-max-users

pm list packages: prints all packages, optionally only

those whose package name contains the text in FILTER. Options:

-f: see their associated file.

-d: filter to only show disbled packages.

-e: filter to only show enabled packages.

-s: filter to only show system packages.

-3: filter to only show third party packages.

-i: see the installer for the packages.

-u: also include uninstalled packages.

pm list permission-groups: prints all known permission groups.

pm list permissions: prints all known permissions, optionally only

those in GROUP. Options:

-g: organize by group.

-f: print all information.

-s: short summary.

-d: only list dangerous permissions.

-u: list only the permissions users will see.

pm list instrumentation: use to list all test packages; optionally

supply

pm list features: prints all features of the system.

pm list users: prints all users on the system.

pm path: print the path to the .apk of the given PACKAGE.

pm dump: print system state associated with the given PACKAGE.

pm install: install a single legacy package

pm install-create: create an install session

-l: forward lock application

-r: replace existing application

-t: allow test packages

-i: specify the installer package name

-s: install application on sdcard

-f: install application on internal flash

-d: allow version code downgrade

-p: partial application install

-g: grant all runtime permissions

-S: size in bytes of entire session

pm install-write: write a package into existing session; path may

be ‘-‘ to read from stdin

-S: size in bytes of package, required for stdin

pm install-commit: perform install of fully staged session

pm install-abandon: abandon session

pm set-installer: set installer package name

pm uninstall: removes a package from the system. Options:

-k: keep the data and cache directories around after package removal.

pm clear: deletes all data associated with a package.

pm enable, disable, disable-user, disable-until-used: these commands

change the enabled state of a given package or component (written

as "package/class").

pm grant, revoke: these commands either grant or revoke permissions

to apps. The permissions must be declared as used in the app‘s

manifest, be runtime permissions (protection level dangerous),

and the app targeting SDK greater than Lollipop MR1.

pm reset-permissions: revert all runtime permissions to their default state.

pm get-install-location: returns the current install location.

0 [auto]: Let system decide the best location

1 [internal]: Install on internal device storage

2 [external]: Install on external media

pm set-install-location: changes the default install location.

NOTE: this is only intended for debugging; using this can cause

applications to break and other undersireable behavior.

0 [auto]: Let system decide the best location

1 [internal]: Install on internal device storage

2 [external]: Install on external media

pm trim-caches: trim cache files to reach the given free space.

pm create-user: create a new user with the given USER_NAME,

printing the new user identifier of the user.

pm remove-user: remove the user with the given USER_IDENTIFIER,

deleting all data associated with that user

原文地址:https://www.cnblogs.com/FlyToDream/p/10419755.html

时间: 2024-10-27 11:50:31

adb shell 命令之----pm的相关文章

【Android】-- adb shell 命令探索

ADB是什么,做android开发的没有不知道的. window下运行cmd,输入adb help就会打印adb都能够做的事情,包括 adb push ..adb pull .. adb devices  adb install... 等等..并且一搜一大把. 其中有一个命令叫做  adb shell,android是基于linux的,shell模式下linux的命令可是非常多的,android去掉了许多linux的命令,那么从这写命令里面又能够发现什么宝藏呢?寻宝之旅开启!! 首先linux的

【android】android 常用adb 和 adb shell 命令

db是SDK自带的工具,可实现桥接功能:adb shell 可以与手机系统建立交互,是基于andoid Linux系统下的操作 ADB常用命令: 1. 查看设备         adb  devices 这个命令是查看当前连接的设备, 连接到计算机的android设备或者模拟器将会列出显示 2. 安装软件 adb  install <apk文件路径> 这个命令将指定的apk文件安装到设备上       参数“-r”,它是更新安装的意思,       参数 -s ,安装到sdcard.     

Android 常用adb shell 命令(转)

调试Android程序有时需要adb shell 命令,adb全称Android Debug Bridge ,就是起到调试桥的作用. 通过adb我们可以在Eclipse中通过DDMS来调试Android程序,说白了就是debug工具.adb通过监听Socket TCP 5554等端口让IDE和Qemu通讯. 默认情况下当我们运行Eclipse时adb进程就会自动运行.adb是一个C/S模式的程序,由三个部分组成:a client,a server and a daemon. 其中client和s

Android 执行 adb shell 命令

Android 执行Adb shell 命令大多需要root权限,Android自带的Runtime. getRuntime().exec()容易出错,在网上找到了一个执行adb shell命令的类 代码如下: /**检查手机是否存在root权限,发送一些消息*/package com.dx.superbar.util; import java.io.DataOutputStream;import java.io.File;import java.io.FileOutputStream;impo

adb shell命令后出现error: device not found错误提示

在cmd中输入adb shell进入linux shell环境前,需要把android模拟器打开(本文都是针对模拟器而言,并非真机).如果启动好了模拟器,且输入adb shell命令后出现error: device not found错误提示,则可以杀掉adb进程然后重新启动该进程,在cmd中输入如下命令: adb kill-server adb start-server 注意:这里着重注意,要想adb shell命令执行成功,必须要同时打开android模拟器. 这是执行成功后,以root权限

ADB Shell命令

adb shell命令:ls cat df uptime ps kill dumpsys battery 电池电量相关信息 dumpsys WIFI 无线网络相关信息 dumpsys power 电源管理相关信息 dumpsys telephony.registry 电话相关信息 cat /proc/cpuinfo CUP相关信息 cat /proc/meminfo 内存相关信息 cat /proc/iomem I/O内存分区相关信息 cat /system/buid.prop | findst

adb shell 命令详解,android

http://www.miui.com/article-275-1.html http://noobjava.iteye.com/blog/1914348 adb shell 命令详解,android 博客分类: android 常用:1.进入模拟器的shell模式 :  adb shell 2.安装应用程序:  adb install -r 应用程序.apkadb installadb install <apk文件路径> :这个命令将指定的apk文件安装到设备上adb install  -r

Android 常用adb shell 命令

调试Android程序有时需要adb shell 命令,adb全称Android Debug Bridge ,就是起到调试桥的作用.通过adb我们可以在Eclipse中通过DDMS来调试Android程序,说白了就是debug工具.adb通过监听Socket TCP 5554等端口让IDE和Qemu通讯.默认情况下当我们运行Eclipse时adb进程就会自动运行.adb是一个C/S模式的程序,由三个部分组成:a client,a server and a daemon.其中client和serv

adb shell 命令返回&#39;grep&#39; 不是内部或外部命令,也不是可运行的程序

C:\Users\Vicky>adb shell dumpsys window windows | grep mCurrent'grep' 不是内部或外部命令,也不是可运行的程序或批处理文件. 解决方法:在adb shell 后面的内容加上双引号就不会报错啦 C:\Users\Vicky>adb shell "dumpsys window windows|grep mCurrent" mCurrentFocus=Window{cd554b4 u0 com.alibaba.a