我試圖從命令行獲取應用程序及其可啓動活動的列表。我知道aapt在adb shell上轉儲標記
aapt dump badging
會給我這個信息。我只是想知道是否可以從adb shell的上下文中獲取這些信息。我意識到我可以將文件拖到本地機器上,但某些APK相當大,所以我寧願直接從設備上獲取該信息...
我試圖從命令行獲取應用程序及其可啓動活動的列表。我知道aapt在adb shell上轉儲標記
aapt dump badging
會給我這個信息。我只是想知道是否可以從adb shell的上下文中獲取這些信息。我意識到我可以將文件拖到本地機器上,但某些APK相當大,所以我寧願直接從設備上獲取該信息...
我不知道adb shell是這樣做的,但是你可以在Java中使用它來讀取所有這些信息。
請參閱PackageManager。
嘗試adb shell pm list packages
。這會給你所有的軟件包。至於可啓動的活動,請嘗試與adb shell am start
混合。
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知道在其輸出端的頂部:你可能感興趣的只有adb shell dumpsys package
輸出
Currently running services:
SurfaceFlinger
accessibility
account
activity
alarm
...
package
...
你的情況。
。現在我只需要弄清楚grep命令就可以從怪物中抓住它們。 :) – Ben 2013-04-25 17:14:57
您是否在談論根植設備? – 2013-04-25 04:50:02
沒有。這不是完美的根植設備 – Ben 2013-04-25 17:15:45