当前位置: 首页 > 知识库问答 >
问题:

为什么'pm install'和其他pm命令在我的设备上不起作用?

邬承悦
2023-03-14

今天我发现我不能运行我的应用程序从Android studio到我的设备,以下是日志。

Target device: xiaomi-mi_note_pro-21712f58
Uploading file
    local path: E:\weiyun\workspace\xkm\iKM\build\outputs\apk\iKM-debug.apk
    remote path: /data/local/tmp/com.ikm
Installing com.ikm
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.ikm"
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] [PATH]
       pm install-create [-lrtsfdp] [-i PACKAGE] [-S BYTES]
       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 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 PACKAGE PERMISSION
       pm revoke PACKAGE PERMISSION
       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
       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  to list the test packages for a particular
  application.  Options:
    -f: list the .apk file for the test package.

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
    -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 applications.  Only optional permissions the application has
  declared can be granted or revoked.

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



Launching application: com.ikm/com.ikm.MainActivity.
DEVICE SHELL COMMAND: am start  -n "com.ikm/com.ikm.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.ikm/.MainActivity }
Error type 3
Error: Activity class {com.ikm/com.ikm.MainActivity} does not exist.

看起来包被复制到了设备中,但是当执行shell命令pm install时,它就是识别不出这个命令?

我也试过其他类似pm clear的东西,也不起作用。

并且我尝试了adb install-r....apk,我可以看到发送的文件,但没有显示任何成功或失败的结果。

安装app的唯一方法是手动方式,将apk复制到设备中,打开apk文件。

共有1个答案

韦昊焜
2023-03-14

是否检查了有效UID的权限和shell(2000)的权限?这会导致Android L+中的一些错误。

 类似资料:
  • 问题内容: 我正在尝试使用Paramiko将SSH SSH到Brocade交换机中并执行远程命令。代码如下所示: 尝试运行代码时,遇到一个奇怪的错误,如下所示。 协议错误,不是以scp开头! 我不知道错误的原因或SSH连接是否成功。你能帮我这个忙吗? 问题答案: 如果不工作时,首先认为测试是尝试(上 一个 行): 它将使用与相同的SSH API(“ exec”通道)。如果您使用的是Windows,

  • 问题内容: 嗨,我只是想创建一个简单的golang应用程序,它使用以下命令在identi.ca上发布新的凹痕 到目前为止,这是我的代码,恕我直言,这应该起作用,但实际上它不起作用,有人知道如何解决此问题吗? 编辑: 不:我没有收到任何错误消息:/ 问题答案: 不会将整个命令行作为单个参数。您需要将其称为: 您怎么知道是否遇到错误?您无需检查的返回值。 您实际上应该将命令创建与运行分开。这样,您可以

  • 我刚刚安装了node.js,还在环境变量中设置了PATH。路径值为 短期内 android命令正常工作。

  • 问题内容: 我需要使用apache配置的php在我的Web服务器上执行一些命令。 输出: 我的猜测是因为我的ubuntu上有php权限!你有什么建议? 问题答案: 您需要运行: 检查你是否有一条线像 在文件顶部添加您自己的本地IP,然后添加一行 最后在您的PHP文件中: (您正在尝试通过Web重新启动apache,也许您不知道webmin界面?我认为有比sudo方法更好的解决方案。授权www- d

  • 我试图在一个网站上使用gettext,为此我遵循O'Reilly媒体教程。在第一页的末尾,它说我需要使用命令,但是我的命令行返回以下内容:我在XAMPP上运行我的网站,所以我的整个目录是这样的: 我有考试。php在gettext文件夹中,以及消息。采购订单位于文件夹中。即使我尝试使用poedit,它也不起作用。这是我的测验。php代码: 我不确定bindtextdomain函数中的字符串是否正确。

  • 我已经设置了一个包含3列的css网格来显示我们的投资组合。我找到了一个Firefox、Internet Explorer和Safari的工作代码。但是在Chrome上,它并没有显示我的网格,所有的图片都在下面。见网址:http://www.ddw-sanitair.be 此外,它不接受“display:none”类的一些图片,因此双/三图像... 有什么建议吗? 我尝试添加网格自动行:270px;