Featured image of post Use the ADB Shell to remove an Android package

Use the ADB Shell to remove an Android package

Enable USB debugging on the Android device

  1. Go the Settings on the Android device.

  2. Scroll down and tap on About Phone or (About Device).

  3. Scroll down to the bottom of the page and look for the Build Number or Build Version entry.

  4. Tap on it repeatedly (usually about seven times) until the message that says You are now a developer! or something similar.

    This will enable the Developer Options menu in the settings.

  5. Go back to the main Settings menu and scoll down to find the Developer Options menu.

    It may be listed as System -> Developer Options on some devices.

  6. Toggle the USB Debugging option to turn it on.

  7. There is a warning message about the potential risks of enabling USB debugging. Read it carefully and tap OK to confirm to enable USB debugging.

Now, you can connect your Android device to your computer using a USB cable and use adb to run commands on the device.

Download and Run the ADB Shell

  1. Go the https://developer.android.com/studio/releases/platform-tools.

  2. Scroll down to the Downloads section and find the appropriate download link for the operating system.

    Example: Download SDK Platform-Tools for Windows

  3. Click the download link to download the zip file containing the Platform Tools.

  4. Once the download is complete, extract the contents of the zip file to a directory.

  5. Navigate to the directory where extracted Platform Tools.

  6. You should see a file called adb (or adb.exe on Windows). This is the adb executable that you can use to run commands on your Android device.

List Packages

  1. Connect your Android device to your computer using a USB cable.

  2. Navigate to the directory where the adb executable is located.

  3. Open a command prompt or terminal window on your computer.

  4. Type the following command to open a shell on your device:

    adb shell
    

    You should see a new command prompt that looks something like this:

    shell@device_name:/ $
    

    The prompt indicates that you are now in the adb shell on your Android device. The text “device_name” will be replaced with your actual device name.

  5. Type the following command to list all installed packages:

    pm list packages  
    

    This will show you a list of all the packages installed on your device, like:

    package:com.android.wallpaper.livepicker
    package:com.android.providers.downloads
    package:com.android.providers.media
    

Remove Packages

  1. Find the package that you want to remove from the list and note down its package name. The package name is the part of the package identifier that comes after “package:”.

    For example: package:com.android.providers.media

  2. Type the following command to remove the package:

    pm uninstall <package-name>  
    

    pm uninstall com.android.providers.media

    Alternatively

    pm uninstall -k --user 0 <package-name>  
    

    pm uninstall -k --user 0 com.android.providers.media

  3. Once you have executed the command, the package will be uninstalled from your device.

MoziCSH
Built with Hugo
Theme Stack designed by Jimmy