Get Application Name/ Label via ADB Shell or Terminal

后端 未结 5 850
南旧
南旧 2020-12-12 14:13

I\'m developing an application that uses ADB Shell to interface with android devices, and I need some way of printing out the application name or label of an application, gi

5条回答
  •  自闭症患者
    2020-12-12 15:08

    If you know the app id of the package (like org.mozilla.firefox), it is easy. First to get the path of actual package file of the appId,

    $  adb shell pm list packages -f com.google.android.apps.inbox
    package:/data/app/com.google.android.apps.inbox-1/base.apk=com.google.android.apps.inbox
    

    Now you can do some grep|sed magic to extract the path : /data/app/com.google.android.apps.inbox-1/base.apk

    After that aapt tool comes in handy :

    $  adb shell aapt dump badging /data/app/com.google.android.apps.inbox-1/base.apk
    ...
    application-label:'Inbox'
    application-label-hi:'Inbox'
    application-label-ru:'Inbox'
    ...
    

    Again some grep magic to get the Label.

提交回复
热议问题