Lists all activities for the app by specified package. If multiple devices are connected it autocompletes serial ID of all available devices
The main purpose is to use it for your own or company projects. If you need to find and fix the bug and don't know where to start because your project is too big and has multiple Activities
If you use it for an obfuscated app (your prod build or someone else's app) you might end up with such weird names:
The main problem with writing a chain of commands to achieve the same result is:
- It's big and hard to remember
- You always need to run an additional command to find a list of connected devices (if there is more than 1)
- No output if nothing found
I propose a handy version with only 1 required option and out-of-the-box autocompletion to choose between available devices:
Compare this chain of commands with lista:
❯ adb devices
List of devices attached
78f2ba2b device
❯ adb -s 78f2ba2b shell dumpsys activity activities \
| grep com.huawei.smarthome | grep Hist \
| awk -F '[{}]' '{print $2}' | cut -d ' ' -f3
com.huawei.smarthome/.activity.MainActivity
❯ lista -p com.huawei.smarthome -s 78f2ba2b
Serial ID: 78f2ba2b
Package name: com.huawei.smarthome
Activity stack:
com.huawei.smarthome/.activity.MainActivity
com.huawei.smarthome/.login.LauncherActivity
As you can see, less typing, more info
lista [options]
-s serial id - device serial ID. Autocompletable field.
It should be used if more than one Android device is connected to your machine.
-p package name (required unless -h is used).
Example: -p "com.google.mail"
-h get help
# If only one device is attached
lista -p "com.google.mail"
# If multiple devices are connected, add serial ID with the -s option. Autocompletable field
lista -p "com.google.mail" -s 78f2ba2b
# Help menu
lista -h
The only prerequisite is to have adb
installed. Usually, it's shipped with Android Studio
-
If you have
Android Studio
installed, you just need to addadb
to the$PATH
variable (guide) -
If not, here is a guide on how to install it - link
You can just download, copy, or clone the code and one of the approaches would be to move this script to /usr/local/bin/
folder.
It's a user scripts folder that can be found in $PATH
.