get launchable activity name of package from adb

后端 未结 8 788
春和景丽
春和景丽 2020-11-28 02:09

Is there a way to get the launchable activity for a package from using adb? For an unroot phone (i.e. without having the pull the apk from /data/

相关标签:
8条回答
  • 2020-11-28 02:20

    You don't need root to pull the apk files from /data/app. Sure, you might not have permissions to list the contents of that directory, but you can find the file locations of APKs with:

    adb shell pm list packages -f
    

    Then you can use adb pull:

    adb pull <APK path from previous command>
    

    and then aapt to get the information you want:

    aapt dump badging <pulledfile.apk>
    
    0 讨论(0)
  • 2020-11-28 02:20

    Launch your app and keep it in foreground.

    Run the below command:

    adb shell dumpsys window windows | find "mcurrentfocus"

    0 讨论(0)
  • 2020-11-28 02:22
    $ adb shell pm dump PACKAGE_NAME | grep -A 1 MAIN
    
    0 讨论(0)
  • 2020-11-28 02:22

    Here is another way to find out apps package name and launcher activity.

    Step1: Start "adb logcat" in command prompt.

    Step2: Open the app (either in emulator or real device) enter image description here

    0 讨论(0)
  • 2020-11-28 02:24

    Since Android 7.0 you can use adb shell cmd package resolve-activity command to get the default activity of an installed app like this:

    adb shell "cmd package resolve-activity --brief com.google.android.calculator | tail -n 1"
    com.google.android.calculator/com.android.calculator2.Calculator
    
    0 讨论(0)
  • 2020-11-28 02:27

    You can also use ddms for logcat logs where just giving search of the app name you will all info but you have to select Info instead of verbose or other options. check this below image.

    0 讨论(0)
提交回复
热议问题