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.
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.
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}'
精彩评论