How to Get Package Name app icon and Main Activity using ADB

ADB or Android Debug Bridge is a command-line tools used for developing and modifying Android devices. ADB allows developers to access the Internal systems of an Android device and perform actions such as installing and debugging apps, copying files to and from the device, and running shell commands. Here is the Instructions to obtain app name, App icon and it’s activity via ADB commands.

Instructions:

  1. Download & setup adb platform tools
  2. connect your android device to your computer via USB cable and enable USB debugging in the developer options.
  3. Open the command prompt or terminal on your computer and navigate to the folder where the ADB tool is installed.
  4. To get the package name of the app, enter the following command:
adb shell pm list packages grep 'app name'

Replace ‘app name‘ with the name of the app whose package name you want to find.

  1. To Get the main activity of the app, enter the following command:
adb shell dumpsys package 'package name' grep -E '^[[:space:]]+intent'

Replace ‘package name‘ with the package name of the app obtained from the previous step.

  1. To get the icon of the app, enter the following command:
adb shell pm path 'package name' awk -F':' '{print $2}' | xargs -I {} sh -c 'unzip -p {} res/mipmap-xxxhdpi/ic_launcher.png' > app_icon.png

Replace ‘package name‘ with the package name of the app obtained from step 4.

  1. The icon of the app will be saved as “app_icon.png” in the same folder where the ADB tool is installed.
  2. or you can use
adb shell dumpsys package 'package name' grep 'path='
adb pull /data/app/com.example.app-1/base.apk app_icon.png