' aapt dump badging'在ADB shell上

时间:2013-03-13 04:16:01

标签: android adb aapt

我正在尝试从命令行获取应用程序列表及其可启动活动。我知道

aapt dump badging

会给我这个信息。我只是想知道我是否可以从ADB shell的上下文中获取此信息。我意识到我可以把文件拉到本地机器,但是有些APK相当大,所以我更愿意直接从设备上获取这些信息......

3 个答案:

答案 0 :(得分:5)

adb shell dumpsys将为您提供大量信息,包括可启动活动。例如,输出将列出对操作android.intent.action.MAIN做出反应的活动:

  android.intent.action.MAIN:
    423fff90 com.android.bluetooth/.bpp.BluetoothBppActivity filter 42400218
    424003d0 com.android.bluetooth/.bpp.BluetoothBppSetting filter 42400608
    42400758 com.android.bluetooth/.bpp.BluetoothBppPrintPrefActivity filter 424009b8
    42400b08 com.android.bluetooth/.bpp.BluetoothBppStatusActivity filter 42400d60
    42400f10 com.android.bluetooth/.bpp.BluetoothBppAuthActivity filter 42401158
    42408bb8 com.google.android.apps.books/.app.BooksActivity filter 42408e88
    42414f50 com.android.providers.calendar/.CalendarContentProviderTests filter 42415270
    42415a38 com.android.providers.calendar/.CalendarDebug filter 42415c28
    42415df0 com.android.providers.calendar/.CalendarDebugActivity filter 42416048
    ...

请注意,输出量很大;你可能想限制输出。您可以在输出的顶部看到dumpsys知道的子类别:

Currently running services:
  SurfaceFlinger
  accessibility
  account
  activity
  alarm
  ...
  package
  ...

在您的情况下,您可能只对adb shell dumpsys package的输出感兴趣。

答案 1 :(得分:0)

我不知道adb shell这样做的方法,但你可以用Java来解读所有这些信息。

请参阅PackageManager

答案 2 :(得分:0)

试试adb shell pm list packages。这将为您提供所有包裹。至于可启动的活动,请尝试使用adb shell am start