Install/Uninstall from Shell Command in Android

Installing and Uninstalling Applications from Android Shell

Android’s shell, also known as the command-line interface, allows advanced users to manage their devices using commands. One of the powerful features is the ability to install and uninstall applications. This article will guide you through the process of using shell commands for app management.

Prerequisites

To utilize these commands, you’ll need:

  • An Android device rooted or with access to ADB (Android Debug Bridge).
  • Familiarity with basic Linux command-line syntax.

Installing Applications

1. Using `pm install`

The pm (Package Manager) command is the primary tool for installing applications. This command takes the APK (Android Package) file as input.

pm install /path/to/app.apk

For example, to install an APK file named “MyApp.apk” located in the “Downloads” directory:

pm install /sdcard/Downloads/MyApp.apk

2. Using `adb install`

The `adb install` command is used when you are connected to your device via ADB. This command requires the APK file to be on your computer.

adb install /path/to/app.apk

For instance, to install an APK named “MyApp.apk” located in the “C:\Downloads” directory on your computer:

adb install C:\Downloads\MyApp.apk

Uninstalling Applications

1. Using `pm uninstall`

The pm uninstall command allows you to remove applications from your device.

pm uninstall com.example.app

Replace com.example.app with the package name of the application you want to uninstall.

2. Using `adb uninstall`

Similar to installing, `adb uninstall` is used for uninstallation when connected through ADB.

adb uninstall com.example.app

Replace com.example.app with the package name of the application you want to uninstall.

Comparing `pm` and `adb`

Feature `pm` `adb`
Execution Directly on device Via ADB connection
APK Location On the device’s storage On the computer
Root Access May require root access Requires root access

Additional Considerations

  • Always use the package name for accurate identification of the app.
  • Uninstalling apps can delete user data, so backup important information.
  • Using shell commands requires caution, as improper usage can harm your device.


Leave a Reply

Your email address will not be published. Required fields are marked *