Skip to content

moshenskyi/lista

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

lista - CLI tool for viewing Activity stack

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

Table of Contents

Obfuscated apps

If you use it for an obfuscated app (your prod build or someone else's app) you might end up with such weird names:

Screenshot 2023-12-29 at 03 48 28

Demo

The main problem with writing a chain of commands to achieve the same result is:

  1. It's big and hard to remember
  2. You always need to run an additional command to find a list of connected devices (if there is more than 1)
  3. 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:

lista-demo

Compare this chain of commands with lista:

Old approach:

❯ 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

New approach:

❯ 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

Usage

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

Examples

# 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

Installation

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 add adb 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.

About

CLI tool to list Activity stack for Android apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages