【问题标题】:'aapt dump badging' on ADB shell [duplicate]ADB shell 上的“aapt dump badging”[重复]
【发布时间】:2013-03-13 04:16:01
【问题描述】:

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

aapt dump badging

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

【问题讨论】:

  • 你说的是root设备吗?
  • 没有。这不在有根设备上

标签: android adb aapt


【解决方案1】:

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 的输出感兴趣。

【讨论】:

  • 完美。现在我只需要弄清楚 grep 命令从那个怪物中抓住它们。 :)
【解决方案2】:

我不知道执行此操作的 adb shell 方式,但您可以在 Java 中敲出一些东西来读取所有这些信息。

PackageManager

【讨论】:

    【解决方案3】:

    试试adb shell pm list packages。这会给你所有的包。至于可启动的活动,请尝试使用adb shell am start

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-06
      • 1970-01-01
      • 2021-11-06
      相关资源
      最近更新 更多