Jump to content

adb workflow for Android developers


Recommended Posts

ADB or Android Debug Bridge is linked to Alfred with this workflow.

 

adb%20alfred.png

 

GitHub release | packal

 

GitHub release

 

I created this workflow because Android developers like me may need to connect to multiple devices at the same time, and it's painful to add `-s {serial}` every time when using adb for a simple feature.

 

Alfred Workflow is a great tool to show lists and options.

 

So here it is:

 

screenshot%2000%20alfred%20flow.png

 

 

Dependencies:

 

These dependencies are included in Android Studio and Android command line tools.

 

Configurations:

 

Add the following environment variables in workflow settings to support its functions

 

Name Value (example)
adb_path ~/Library/Android/sdk/platform-tools/adb
aapt_path ~/Library/Android/sdk/build-tools/28.0.3/aapt
emulator_path ~/Library/Android/sdk/tools/emulator

 

Features:

 

keyword `adb`

 

  •  To list all connected devices.
  • `adb connect`, `adb disconnect`, `adb reset` are also in this level. 
  • WiFi devices will be saved for next time quick connection

screenshot%2001%20list%20devices.png

  • Select one devices for its operations
  • Input commands like "shell dumpsys -l | grep wifi" in this level, to execute directly in terminal

screenshot%2002%20show%20device%20option

  • Select "Show app list" to list installed apk, select one for further operations including:
    • Open app info page
    •  force stop app
    •  launch app
    • clear data
    • uninstall
    • extract apk file to desktop

screenshot%2003%20show%20package%20optio

  • Select "Install apk" to search in local drive for apk files or folders to be (bulk) installed.
  • Currently installed version will be shown, and install operation "-t", "-d", "-g" are supported

screenshot%2004%20show%20install%20optio

 

keyword `apk`

 

  • Search local apk files with package info shown and install them on attached devices.

 

keyword `apkf`

 

  • List local apk files under current front Finder window.

 

keyword `avd`

 

  • List all installed Android emulators and start new emulators

 

References:

 

 

Edited by zjn0505
Fix keyword typo
Link to comment

v 1.2.0 is out there.

 

With two new keywords "apk" and "avd", and improved adb WiFi connection history and app operation shortcuts.

 

"apk" can be used to search local apk files, with package info shown, and the file can be then installed onto attached devices.

 

"avd" can be used to list installed Android emulators, and start a new emulator instance with it.

Link to comment

v1.3.0 is out

  • Add modifiers for "Show app list", to quick launch, uninstall, clear data, force stop and show app info.
  • Add option to extract apk file from devices. "Show app list" -> select package -> "Extract apk file"
  • Add uid to necessary places for auto-sort to prioritize most used items.
  • Improve installation option suggestions, e.g. item of "add 'd' for version downgrade" only appears on necessary.
Edited by zjn0505
Fix typo
Link to comment
  • 2 months later...
  • 2 weeks later...
On 4/1/2019 at 4:14 PM, Petru said:

Pretty cool workflow!
One requirement if I may: Could you add a simple way of entering unicode text?
(`adb shell input text` with escaped input should work)

 

Hi Petru.

 

From my research, that we can't use `adb shell input text  {unicodes}` out of box, no matter how it is escaped.

 

Thus there are tools like this one to support unicode input via adb.
https://github.com/senzhk/ADBKeyBoard

Link to comment
  • 2 years later...

Hi there, this looks really cool, however i cant seem to get it to work.

 

12:25:21 workflow.py:2094 DEBUG    ---------- adb (1.13.2) ----------
12:25:21 workflow.py:1484 DEBUG    reading settings from /Users/"username"/Library/Application Support/Alfred/Workflow Data/xyz.jienan.adb/settings.json
12:25:21 workflow.py:2395 INFO     checking for update ...
12:25:21 background.py:233 DEBUG    [__workflow_update_check] command cached: /Users/dannysilva/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/xyz.jienan.adb/__workflow_update_check.argcache
12:25:21 background.py:237 DEBUG    [__workflow_update_check] passing job to background runner: ['/Applications/Xcode.app/Contents/Developer/usr/bin/python3', '-m', 'workflow.background', '__workflow_update_check']
/Applications/Xcode.app/Contents/Developer/usr/bin/python3: Error while finding module specification for 'workflow.background' (ModuleNotFoundError: No module named 'workflow')
12:25:21 background.py:241 ERROR    [__workflow_update_check] background runner failed with 1

 Can anyone help me out?
Thanks a bunch!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...