There are two ways to install APK on the Android emulator or on a real computer using the command line
One is using the adb install command, which is usually the way online
The other is the command provided via Android, PM install.
Need to go to Android command line first: adb shell
The corresponding PM command is then executed.
PM Command description, reprinted another blog: Android next PM Command detailed
The details are summarized below for later viewing:
0. Usage:
usage:pm [list|path|install|uninstall] pm List Packages [-f]      PM list PERMISSION-GROUPS       PM List permissions [-G] [-f] [-d] [-u] [group] pm list instrumentation [-F] [ TARGET-PACKAGE]       PM List features  PM path PACKAGE       PM Install [-l] [-r] [-T] [-I installer_package_name] [- S] [-f] path pm Uninstall [-K] 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. options: -f:see their associated file. the lIst permission-groups command Prints all knownpermission groups. the List Permissions command prints all Knownpermiss Ions, optionally only those in GROUP. options: -g:organize by Group. -f:print all Information. -s:short summary.& Nbsp; -d:only List Dangerous permissions. -u:list only the permissions users would see. the list ins trumentation command Prints All instrumentations,or is those that target a specified the 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 for a package. the install command installs a package to the system . options: -l:install the Forward_lock. -r:reinstall an exisiting app, keeping I TS Data. -t:allow test. APKs to being installed. -i:specify the installer package name. -s : Install PackagE on Sdcard. -f:install-Internal flash. the Uninstall command removes a package from the Syste M. options: -k:keep the data and cache directories Around.after the package removal. the enable and Disab Le commands change the enabled state OFA given package or component (written as "Package/class"). the Getinstalllocat Ion command gets the current install location 0 [auto]: Let system decide the best location 1 [Inter NAL]: Install on internal device storage 2 [external]: Install on external media the Setinstalllocation Co Mmand 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
1. Specific Use method :
1.1: Look at the installed packages:
PM List Package
This displays all installed package names.
PM List package-f
Also displays the directory where the associated file is located (that is, the saved apk file)
1.2: Look at a known permission group:
PM List permission-groups
1.3: Look at all known permissions :
PM List Permissions
1.4: Lists all hardware-related information :
PM List Features
The results are usually similar:
Feature:reqglesversion=0x20000feature:android.hardware.bluetoothfeature:android.hardware.camerafeature: Android.hardware.locationfeature:android.hardware.location.networkfeature:android.hardware.microphonefeature: Android.hardware.sensor.accelerometerfeature:android.hardware.sensor.compassfeature: Android.hardware.touchscreenfeature:android.hardware.wifi
1.5: Lists associated files (apk archive files) for the specified package name where :
For example:
PM Path Com. Tdijoy.fane
Package:/mnt/asec/com. tdijoy.fane-1/pkg.apk
1.6: Install apk:
PM Install [-l] [-r] [-T] [-I Installer_package_name ] [-S] [-f] path
path refers to the absolute path and file name of the APK file.
For example:
PM install/data/3dijoy_fane.apk
These parameters are useful:
-r: Install an installed APK to keep its data intact.
-I: Specifies the package name for the installation. (did not try to come out)
-S: Install on SDcard .
-F: Installed on internal flash.
1.6: Uninstall APK:
PM Uninstall package name.
For example:
pm Uninstall com. Tdijoy.fane
1.7: Gets and sets the default installation location:
The getinstalllocation command gets the current install location 0 [auto]: Let system decide the best location 1 [Intern AL]: Install on internal device Storage 2 [external]: Install on external Media the setinstalllocation command changes th E default install location 0 [auto]: Let system decide the best location 1 [internal]: Install on internal device Storag e 2 [external]: Install on external media
PM Getinstalllocation
Get the default installation location.
Set up:
PM Setinstalllocation <0|1|2>
0: Automatic.
1: Internal Flash.
2: Extended storage device.
Example: How to install the APK into a USB flash drive on Hisense 2.2 STB:
Sam first tries to use:
PM Setinstalllocation 2
After installation, it is useless.
Later try to do the following:
Select the USB flash drive as the default storage device in the default storage device, such as storage device, other settings.
# PM Install-s xxxx.apk
will be successful.
Android Command line install APK