Skip to content
DeveloperMemos

Uninstalling and Installing Apps with ADB

ADB, App Installation, App Uninstallation1 min read

When it comes to app development and testing on Android devices, ADB (Android Debug Bridge) is a powerful tool that can streamline various tasks. One such task is uninstalling and installing apps directly from the command line. In this article, we'll dive into the process of uninstalling and installing apps using ADB and demonstrate some practical examples in Kotlin.

Prerequisites

To follow along with the examples, you'll need the following prerequisites:

  • Android device connected to your computer via USB debugging enabled
  • ADB installed on your computer
  • Basic knowledge of the command line interface

Uninstalling an App

To uninstall an app using ADB, you'll need the package name of the app. The package name uniquely identifies the app within the system. Here's how you can uninstall an app using ADB:

  1. Open a command prompt or terminal window.
  2. Connect your Android device to your computer via USB.
  3. Ensure USB debugging is enabled on your device.
  4. Run the following command to list all installed packages on the device:
1adb shell pm list packages
  1. Locate the package name of the app you want to uninstall from the list.
  2. Execute the following command to uninstall the app:
1adb uninstall <package_name>

Replace <package_name> with the actual package name of the app.

For example, to uninstall an app with the package name "com.example.myapp," you would run the following command:

1adb uninstall com.example.myapp

Installing an App

Installing an app using ADB is relatively straightforward. Here are the steps:

  1. Make sure you have the APK file of the app you want to install.
  2. Open a command prompt or terminal window.
  3. Connect your Android device to your computer via USB.
  4. Ensure USB debugging is enabled on your device.
  5. Run the following command to install the app:
1adb install path/to/your/app.apk

Replace path/to/your/app.apk with the actual path to the APK file on your computer.

For instance, if the APK file is located at "C:\Users\Username\Documents\app.apk," you would run the following command:

1adb install C:\Users\Username\Documents\app.apk

Conclusion

Using ADB to uninstall and install apps provides a convenient way to manage app installations during development and testing. By leveraging the power of command-line tools, developers can streamline their workflow and perform these tasks efficiently. Understanding how to use ADB for app management is a valuable skill for any Android developer.