Answers:
在adb shell或终端仿真器中(很可能是通过SSH),您可以使用该pm
实用程序来安装应用程序。该命令是:
pm install /sdcard/app1.apk
以下是开关pm
:
usage: pm [list|path|install|uninstall]
pm list packages [-f] [-d] [-e] [-u] [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 path PACKAGE
pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] PATH
pm uninstall [-k] PACKAGE
pm clear PACKAGE
pm enable PACKAGE_OR_COMPONENT
pm disable PACKAGE_OR_COMPONENT
pm setInstallLocation [0/auto] [1/internal] [2/external]
The list packages command prints all packages, optionally only
those whose package name contains the text in FILTER. Options:
-f: see their associated file.
-d: filter to include disbled packages.
-e: filter to include enabled packages.
-u: also include uninstalled packages.
The list permission-groups command prints all known
permission groups.
The list permissions command 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.
The list instrumentation command prints all instrumentations,
or only those that target a specified package. Options:
-f: see their associated file.
The list features command prints all features of the system.
The path command prints the path to the .apk of a package.
The install command installs a package to the system. Options:
-l: install the package with FORWARD_LOCK.
-r: reinstall an exisiting app, keeping its data.
-t: allow test .apks to be installed.
-i: specify the installer package name.
-s: install package on sdcard.
-f: install package on internal flash.
The uninstall command removes a package from the system. Options:
-k: keep the data and cache directories around.
after the package removal.
The clear command deletes all data associated with a package.
The enable and disable commands change the enabled state of
a given package or component (written as "package/class").
The getInstallLocation command gets 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
The setInstallLocation command changes the default install location
0 [auto]: Let system decide the best location
1 [internal]: Install on internal device storage
2 [external]: Install on external media
例如,您可以强制应用直接安装到外部存储(Froyo / Gingerbread风格)。
PS该wget
实用程序应可通过CM7上的BusyBox使用。如果没有,您可以随时通过Android Market进行安装。
pm
确实存在于/system/bin/pm
,但不幸的是通过SSH(即使是root用户)它也无能为力。运行任何pm
命令都不会产生任何输出。我做错什么了吗?它确实可以在终端仿真器中工作,但由于某些原因不能通过SSH :(
adb
只能通过USB电缆工作,不是吗?SSH可以通过无线网络进行。另外,ssh
到处都有,但adb
必须安装。
我建议您将手机插入安装了sdk(或至少adb)并处于调试模式的PC。之后,编写一个脚本,遍历您的应用程序并通过adb安装它们,例如adb install x:\path\to\app1.apk
。
cp * /data/app && reboot
cat
命令。
pm install /sdcard/app1.apk
将adb install
执行与adb shell,终端仿真器相同的操作,并且可以在SSH中执行。查看pm
更多选项的输出。甚至有一个开关可以强制应用程序直接安装到外部存储(姜饼风格)。