Enable USB debugging on the Android device
-
Go the
Settings
on the Android device. -
Scroll down and tap on
About Phone
or (About Device
). -
Scroll down to the bottom of the page and look for the
Build Number
orBuild Version
entry. -
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. -
Go back to the main
Settings
menu and scoll down to find theDeveloper Options
menu.It may be listed as
System
->Developer Options
on some devices. -
Toggle the
USB Debugging
option to turn it on. -
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
-
Go the https://developer.android.com/studio/releases/platform-tools.
-
Scroll down to the
Downloads
section and find the appropriate download link for the operating system.Example:
Download SDK Platform-Tools for Windows
-
Click the download link to download the zip file containing the Platform Tools.
-
Once the download is complete, extract the contents of the zip file to a directory.
-
Navigate to the directory where extracted Platform Tools.
-
You should see a file called
adb
(oradb.exe
on Windows). This is the adb executable that you can use to run commands on your Android device.
List Packages
-
Connect your Android device to your computer using a USB cable.
-
Navigate to the directory where the adb executable is located.
-
Open a command prompt or terminal window on your computer.
-
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.
-
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
-
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
-
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
-
Once you have executed the command, the package will be uninstalled from your device.