Is there a way to list all the activities of a particular .apk file from the shell? I found this post which describes how to list all the activities in an apk but it is not for the shell.
Asked
Active
Viewed 2.6k times
28
-
Are you doing this on the device or on the computer? – Otra Jul 01 '11 at 12:05
-
I'm using adb shell to connect to an emulator (though being able to adb shell on a device would be nice) – amccormack Jul 01 '11 at 12:11
-
1The aapt command can do that. See my post here: http://stackoverflow.com/questions/5728903/reading-activity-names-from-apk-file-in-android – Albin Sep 08 '11 at 10:16
2 Answers
51
If you can pull out the apk file to your own machine, you can use the aapt command in the Android SDK
aapt dump xmltree <apk-file> AndroidManifest.xml
The format is a bit perplexing at first, but all the info is there.

Albin
- 4,180
- 2
- 27
- 19
-
7Probably worth mentioning that the ``aapt`` binary can be found under the ``
/build-tools/ – Felipe Lima Oct 29 '14 at 21:48/`` directory -
1
5
The solution from @Albin will print all the elements in AndroidManifest.xml
, we need to filter the output. Here is another solution only print activities as the question ask.
aapt list -a /path/to/the/apk | sed -n '/ activity /{:loop n;s/^.*android:name.*="\([^"]\{1,\}\)".*/\1/;T loop;p;t}'

alijandro
- 11,627
- 2
- 58
- 74