🔪Swiss-army knife for Android testing and development 🔪 ⛺

Overview

ADB Enhanced Downloads PyPI version

LintPython3 InstallAdbeTest AdbeInstallTestsPython3 AdbeUnitTestsPython3

AdbeUnitTestsPython3-Api16 AdbeUnitTestsPython3-Api21 AdbeUnitTestsPython3-Api22 AdbeUnitTestsPython3-Api23 AdbeUnitTestsPython3-Api24 AdbeUnitTestsPython3-Api25 AdbeUnitTestsPython3-Api26 AdbeUnitTestsPython3-Api27 AdbeUnitTestsPython3-Api28 AdbeUnitTestsPython3-Api29

Logo

ADB-Enhanced is a Swiss-army knife for Android testing and development. A command-line interface to trigger various scenarios like screen rotation, battery saver mode, data saver mode, doze mode, permission grant/revocation. Its a wrapper around adb and not a replacement.

Release announcement

See Release announcement

Installation

sudo pip3 install adb-enhanced

Note

  1. sudo pip install adb-enhanced for python2 based install works as well but, I would recommend moving to python3 since I will deprecate python2 support anytime after Dec 31, 2018.
  2. If you don't have sudo access or you are installing without sudo then adbe might not be configured correctly in the path.
  3. To setup bash/z-sh auto-completion, execute sudo pip3 install infi.docopt-completion && docopt-completion $(which adbe) after installing adb-enhanced.

Examples

Device configuration

  • Turn doze mode on

    adbe doze on

  • Turn mobile-data off

    adbe mobile-data off

  • Turn on battery saver

    adbe battery saver on

  • Don't keep activities in the background

    adbe dont-keep-activities on

  • Take a screenshot adbe screenshot ~/Downloads/screenshot1.png

  • Take a video adbe screenrecord video.mp4 # Press ^C when finished

  • Turn Wireless Debug mode on adbe enable wireless debugging

Permissions

  • Grant storage-related runtime permissions

    adbe permissions grant com.example storage

  • Revoke storage-related runtime permissions

    adbe permissions revoke com.example storage

Interacting with app

  • Start an app

    adbe start com.example

  • Kill an app

    adbe force-stop com.example

  • Clear app data - equivalent of uninstall and reinstall

    adbe clear-data com.example

  • ls/cat/rm any file without worrying about adding "run-as" or "su root"

    adbe ls /data/data/com.example/databases # Works as long as com.example is a debuggable package or shell has the root permission or directory has been made publicly accessible

Device info

  • Detailed device info including model name, Android API version etc, device serial

    $ adbe devices
    Unlock Device "dcc54112" and give USB debugging access to this PC/Laptop by unlocking and reconnecting the device. More info about this device: "unauthorized usb:339869696X transport_id:17"
    
    Serial ID: dcc54111
    Manufacturer: OnePlus
    Model: ONEPLUS A5000 (OnePlus 5T)
    Release: 8.1.0
    SDK version: 27
    CPU: arm64-v8a
    
    Serial ID: emulator-5554
    Manufacturer: unknown
    Model: Android SDK built for x86
    Release: 4.4.2
    SDK version: 19
    CPU: x86
    

App info

  • Detailed information about app version, target SDK version, permissions (requested, granted, denied), installer package name, etc.

    $ adbe app info com.google.android.youtube
    App name: com.google.android.youtube
    Version: 12.17.41
    Version Code: 121741370
    Is debuggable: False
    Min SDK version: 21
    Target SDK version: 26
    
    Permissions:
    
    Install time granted permissions:
    com.google.android.c2dm.permission.RECEIVE
    android.permission.USE_CREDENTIALS
    com.google.android.providers.gsf.permission.READ_GSERVICES
    com.google.android.youtube.permission.C2D_MESSAGE
    android.permission.MANAGE_ACCOUNTS
    android.permission.SYSTEM_ALERT_WINDOW
    android.permission.NFC
    android.permission.CHANGE_NETWORK_STATE
    android.permission.RECEIVE_BOOT_COMPLETED
    com.google.android.gms.permission.AD_ID_NOTIFICATION
    android.permission.INTERNET
    android.permission.GET_PACKAGE_SIZE
    android.permission.ACCESS_NETWORK_STATE
    android.permission.VIBRATE
    android.permission.ACCESS_WIFI_STATE
    android.permission.WAKE_LOCK
    
    Runtime Permissions not granted and not yet requested:
    android.permission.WRITE_EXTERNAL_STORAGE
    android.permission.MANAGE_DOCUMENTS
    android.permission.GET_ACCOUNTS
    android.permission.CAMERA
    android.permission.RECORD_AUDIO
    android.permission.READ_CONTACTS
    android.permission.ACCESS_FINE_LOCATION
    android.permission.ACCESS_COARSE_LOCATION
    android.permission.READ_PHONE_STATE
    android.permission.SEND_SMS
    android.permission.RECEIVE_SMS
    com.sec.android.provider.badge.permission.READ
    com.sec.android.provider.badge.permission.WRITE
    com.htc.launcher.permission.READ_SETTINGS
    com.htc.launcher.permission.UPDATE_SHORTCUT
    com.sonyericsson.home.permission.BROADCAST_BADGE
    com.sonymobile.home.permission.PROVIDER_INSERT_BADGE
    android.permission.READ_EXTERNAL_STORAGE
    
    Installer package name: None
    
  • App backup to a tar file unlike the Android-specific .ab format

    $ adbe app backup com.google.android.youtube backup.tar
    you might have to confirm the backup manually on your device's screen, enter "00" as password...
    Successfully backed up data of app com.google.android.youtube to backup.tar
    

Usage

adbe [options] rotate (landscape | portrait | left | right)
adbe [options] gfx (on | off | lines)
adbe [options] overdraw (on | off | deut)
adbe [options] layout (on | off)
adbe [options] airplane (on | off)
adbe [options] battery level <percentage>
adbe [options] battery saver (on | off)
adbe [options] battery reset
adbe [options] doze (on | off)
adbe [options] jank <app_name>
adbe [options] devices
adbe [options] top-activity
adbe [options] dump-ui <xml_file>
adbe [options] mobile-data (on | off)
adbe [options] mobile-data saver (on | off)
adbe [options] wifi (on | off)
adbe [options] rtl (on | off)
adbe [options] screenshot <filename.png>
adbe [options] screenrecord <filename.mp4>
adbe [options] dont-keep-activities (on | off)
adbe [options] animations (on | off)
adbe [options] show-taps (on | off)
adbe [options] stay-awake-while-charging (on | off)
adbe [options] input-text <text>
adbe [options] press back
adbe [options] open-url <url>
adbe [options] permission-groups list all
adbe [options] permissions list (all | dangerous)
adbe [options] permissions (grant | revoke) <app_name> (calendar | camera | contacts | location | microphone | phone | sensors | sms | storage)
adbe [options] notifications list
adbe [options] apps list (all | system | third-party | debug | backup-enabled)
adbe [options] standby-bucket get <app_name>
adbe [options] standby-bucket set <app_name> (active | working_set | frequent | rare)
adbe [options] restrict-background (true | false) <app_name>
adbe [options] ls [-a] [-l] [-R|-r] <file_path>
adbe [options] rm [-f] [-R|-r] <file_path>
adbe [options] mv [-f] <src_path> <dest_path>
adbe [options] pull [-a] <file_path_on_android>
adbe [options] pull [-a] <file_path_on_android> <file_path_on_machine>
adbe [options] push <file_path_on_machine> <file_path_on_android>
adbe [options] cat <file_path>
adbe [options] start <app_name>
adbe [options] stop <app_name>
adbe [options] restart <app_name>
adbe [options] force-stop <app_name>
adbe [options] clear-data <app_name>
adbe [options] app info <app_name>
adbe [options] app path <app_name>
adbe [options] app signature <app_name>
adbe [options] app backup <app_name> [<backup_tar_file_path>]
adbe [options] install <file_path>
adbe [options] uninstall [--first-user] <app_name>
adbe [options] enable wireless debugging
adbe [options] disable wireless debugging
adbe [options] screen (on | off | toggle)
adbe [options] alarm (all | top | pending | history)

Options

-e, --emulator          directs the command to the only running emulator
-d, --device            directs the command to the only connected "USB" device
-s, --serial SERIAL     directs the command to the device or emulator with the given serial number or qualifier.
                        Overrides ANDROID_SERIAL environment variable.
-l                      For long list format, only valid for "ls" command
-R                      For recursive directory listing, only valid for "ls" and "rm" command
-r                      For delete file, only valid for "ls" and "rm" command
-f                      For forced deletion of a file, only valid for "rm" command
-v, --verbose           Verbose mode

Python3 migration timeline

  • Nov 27, 2017 - Code is Python3 compatible
  • Jan 18, 2018 - pip (python package manager) has the updated version which is Python3 compatible
  • Nov 15, 2018 - Python2 based installation discouraged. Python3 is recommended.
  • Dec 31, 2018 - Python2 will not be officially supported after Dec 31, 2018.
  • May 7, 2020 - Python2 no longer works with the current master branch

Testing

make lint
make test

Release a new build

A new build can be released using release/release.py script. Build a test release via make release_debug. Build a production release via make release_production

Updating docs for ReadTheDocs

pandoc --from=markdown --to=rst --output=docs/README.rst README.md && cd docs && make html You will have to do brew install pandoc if you are missing pandoc.

Note: The inspiration of this project came from android-scripts.

Comments
  • New logo/icon proposal

    New logo/icon proposal

    Good day sir. I am a graphic designer and i am interested in designing a logo for your good project. I will be doing it as a gift for free. I just need your permission first before I begin my design. Hoping for your positive feedback. Thanks

    opened by mansya 16
  • Reporting to use python3 even though it was installed with pip3

    Reporting to use python3 even though it was installed with pip3

    I install adb-enhanced with pip3 and have python 3.7 setup on my system. asyncio is also correctly installed.

    However, when I run adbe apps list debug, it prints out "Use python3 for faster execution of this call".

    Do you know or have any ideas what might be wrong?

    From checking the code I can see that this is printed if the system version is less than 3.5 or there was an error when importing asyncio. However, everything is installed from scratch and this is still happening.

    opened by lordcodes 11
  • Show values of settings

    Show values of settings

    As recommeneded in https://github.com/ashishb/adb-enhanced/issues/80

    Show value of settings before and after the operation. For example,

    $ python3 src/main.py show-taps on
    Show user taps state changed from "off" -> "on"
    $ python3 src/main.py show-taps on
    Show user taps state unchanged (on)
    $ python3 src/main.py show-taps off
    Show user taps state changed from "on" -> "off"
    

    I have implemented it for the following settings.

    1. adbe [options] mobile-data (on | off)
    2. adbe [options] battery saver (on | off) - done
    3. adbe [options] mobile-data saver (on | off)
    4. adbe [options] dont-keep-activities (on | off)
    5. adbe [options] stay-awake-while-charging (on | off)
    6. adbe [options] show-taps (on | off)

    I have not yet implemented it for the following settings

    1. adbe [options] gfx (on | off | lines)
    2. adbe [options] overdraw (on | off | deut)
    3. adbe [options] doze (on | off)
    4. adbe [options] rtl (on | off)
    5. adbe [options] animations (on | off)
    opened by ashishb 7
  • Issue 120

    Issue 120

    • Add support for top alarms :
    $ adbe alarm top
    android
    	Action: TIME_TICK
    	Running time: +4s300ms
    	Number of device woke up: 0
    	Number of alarms: 1973
    	User ID: 1000
    android
    	Action: com.android.server.action.NETWORK_STATS_POLL
    	Running time: +3s537ms
    	Number of device woke up: 0
    	Number of alarms: 66
    	User ID: 1000
    android
    	Action: WifiConnectivityManager Schedule Periodic Scan Timer
    	Running time: +770ms
    	Number of device woke up: 692
    	Number of alarms: 692
    	User ID: 1000
    android
    	Action: WifiConnectivityManager Schedule Watchdog Timer
    	Running time: +154ms
    	Number of device woke up: 98
    	Number of alarms: 98
    	User ID: 1000
    com.android.providers.calendar
    	Action: com.android.providers.calendar.intent.CalendarProvider2
    	Running time: +92ms
    	Number of device woke up: 6
    	Number of alarms: 6
    	User ID: u0a42
    android
    	Action: com.android.server.NetworkTimeUpdateService.action.POLL
    	Running time: +71ms
    	Number of device woke up: 0
    	Number of alarms: 1
    	User ID: 1000
    com.android.deskclock
    	Action: indicator
    	Running time: +32ms
    	Number of device woke up: 1
    	Number of alarms: 1
    	User ID: u0a95
    android
    	Action: ScheduleConditionProvider.EVALUATE
    	Running time: +24ms
    	Number of device woke up: 3
    	Number of alarms: 3
    	User ID: 1000
    
    opened by A-YATTA 6
  • Installation issue

    Installation issue

    The tool is not usable after an installation from PyPI with pip. In a venv:

    $ pip3 install adb-enhanced
    Collecting adb-enhanced
      Downloading https://files.pythonhosted.org/packages/d1/f2/1a107465266ace455d0b04fecfd108d352a205abad30641c66f041b41645/adb_enhanced-2.5.2-py3-none-any.whl
    Collecting future (from adb-enhanced)
    [...]
      Stored in directory: /home/test/.cache/pip/wheels/d7/69/b4/3200b95828d1f0ddb3cb5699083717f4fdbd9b4223d0644c57
    Successfully built psutil
    Installing collected packages: future, docopt, asyncio, psutil, adb-enhanced
    Successfully installed adb-enhanced-2.5.2 asyncio-3.4.3 docopt-0.6.2 future-0.18.2 psutil-5.7.0
    WARNING: You are using pip version 19.1.1, however version 20.0.2 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    $ adbe doze on
    Traceback (most recent call last):
      File "/home/test/Documents/repos/adbe/bin/adbe", line 6, in <module>
        from adbe.main import main
    ModuleNotFoundError: No module named 'adbe'
    
    opened by fabaff 6
  • [Feature request] When multiple devices connected issue command to all of them

    [Feature request] When multiple devices connected issue command to all of them

    When using adbe and have multiple devices connected an error is thrown, Would it be appropriate to just send the command to all devices? here is some small shell script in accepted answer: https://stackoverflow.com/questions/17882474/running-adb-commands-on-all-connected-devices

    opened by YuraLaguta 6
  • Cannot install using pip3

    Cannot install using pip3

    Hello, I run this command: sudo pip3 install adb-enhanced and get this error:

    Collecting adb-enhanced Could not fetch URL https://pypi.python.org/simple/adb-enhanced/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) - skipping Could not find a version that satisfies the requirement adb-enhanced (from versions: ) No matching distribution found for adb-enhance

    Any ideas?

    opened by IgorGanapolsky 5
  • install  fail, No such file or directory: 'version.txt'

    install fail, No such file or directory: 'version.txt'

    hello ,ashishb, it is fail when i install this tools, help

    ➜ ~ sudo pip install adb-enhanced The directory '/Users/lu/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/lu/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting adb-enhanced Downloading https://files.pythonhosted.org/packages/e9/58/b0f54dd63d4ee28e3fbb656ff76bc6c5be60d3591837214704d604a0cf04/adb-enhanced-1.8.8.tar.gz (338kB) 100% |████████████████████████████████| 348kB 502kB/s Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/private/tmp/pip-install-CWbKNB/adb-enhanced/setup.py", line 4, in with open('version.txt', 'r') as fh: IOError: [Errno 2] No such file or directory: 'version.txt'

    ----------------------------------------
    

    Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-CWbKNB/adb-enhanced/ ➜ ~ ➜ ~

    opened by AU3904 5
  • Support Alarm Manager output.

    Support Alarm Manager output.

    I can check all alarms of my app with this script adb shell dumpsys alarm | grep -A 2 com.myapp.name

    The output is useful but show a lot of information and is hard to read. It will be great if you can take time to work on this. Thank you.

    opened by nguyencongbinh 4
  • Split list system apps

    Split list system apps

    Split list_system_apps():

    • get_list_system_apps(): return a list of installed system packages
    • print_list_system_apps(): print list of installed system packages
    opened by A-YATTA 3
  • Replace 'pm list packages' with 'dumpsys package'

    Replace 'pm list packages' with 'dumpsys package'

    In some cases, the command 'pm list packages' will not list all enabled third party packages (same for -e and -s). https://stackoverflow.com/questions/63416599/adb-shell-pm-list-packages-missing-some-packages

    opened by A-YATTA 3
  • Airplane mode

    Airplane mode

    opened by A-YATTA 0
  • `adbe input-text` should support unicode characters

    `adbe input-text` should support unicode characters

    Currently, it does not support Unicode characters and fails. See https://stackoverflow.com/questions/14224549/adb-shell-input-unicode-character for how to go abut it.

    opened by ashishb 1
Owner
Ashish Bhatia
Software Engineer - SF Bay area https://ashishb.net/about/
Ashish Bhatia
Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.

Stetho Stetho is a sophisticated debug bridge for Android applications. When enabled, developers have access to the Chrome Developer Tools feature nat

Facebook 12.6k Jan 7, 2023
A library for debugging android databases and shared preferences - Make Debugging Great Again

Android Debug Database Android Debug Database is a powerful library for debugging databases and shared preferences in Android applications Android Deb

AMIT SHEKHAR 8.1k Dec 29, 2022
Under the Hood is a flexible and powerful Android debug view library. It uses a modular template system that can be easily extended to your needs, although coming with many useful elements built-in.

Under the Hood - Android App Debug View Library Under the Hood is a flexible and powerful Android debug view library. It uses a modular template syste

Patrick Favre-Bulle 217 Nov 25, 2022
A Read-Eval-Print-Loop server for Android and SQLite

Android DebugPort Android DebugPort is a drop-in utility which allows you to write and execute code within your app's context, at runtime, and from th

Jason Feinstein 148 Nov 14, 2022
Easy android exception tracer and handler.

Introduction Lup is a small android library that can help you to tracking bug that causes application stopped working (force close). Whiting this libr

icodeu 4 Sep 29, 2022
Cordova plugin for Android Serial USB communication (easily connect an Arduino board to an Android device).

PR-DC cordova-plugin-serialusb Cordova plugin for Android Serial USB communication. This plugin makes a connection to the external board trivial, for

PR-DC 3 May 8, 2022
Android library to record the network calls through the interceptor mechanism of the http clients.

Android Snooper Introduction Android Snooper is a library which helps in debugging issues while running the applications on android devices. One of th

Prateek 151 Nov 25, 2022
traffic debugging library for android

TrafficMonitor About Display traffic per Activity.Observing traffic is used by TrafficStats API. OkHttp Interceptor observer is implementing. Demo Bai

Tetsuya Masuda 17 Feb 4, 2022
Sources for the LiveBoot app for rooted Android devices

This is the sauce for the LiveBoot app. License Copyright © 2011-2020 Jorrit Chainfire Jongma This code is released under the GPLv3. LICENSE, COPYING.

Chainfire 131 Jan 9, 2023
android logcat

android logcat

Ji Sungbin 3 Dec 2, 2022
A local ADB shell for Android!

LADB A local ADB shell for Android! How does it work? LADB bundles an ADB server within the app libraries. Normally, this server cannot connect to the

Tyler 1.1k Jan 2, 2023
btrace(AKA RheaTrace) is a high performance Android trace tool which is based on Systrace

btrace README 中文版 btrace(AKA RheaTrace) is a high performance Android trace tool

Bytedance Inc. 1.2k Jan 4, 2023
Pluto: An on-device debugging framework for Android applications

Pluto is an on-device debugging framework for Android applications, which helps in the inspection of HTTP requests/responses, captures Crashes, and ANRs, and manipulates application data on the go.

Pluto 550 Dec 27, 2022
Swiss army knife for identifying and fingerprinting Android devices.

fingerprint android Lightweight library for device identification and fingerprinting. Fully written in Kotlin. 100% Crash-free. Creates a device ident

FingerprintJS 357 Jan 7, 2023
WalletConnect Kit is the Swiss Army toolkit for WalletConnect!

WalletConnectKit WalletConnectKit is the Swiss Army toolkit for WalletConnect! It will allow you to connect your DApp with an Ethereum Wallet in a few

Pink Room 52 Nov 24, 2022
CHAOS - Like a utility knife for discord

CHAOS - Like a utility knife for discord. Currently under development. If you feel inclined, please support me by contributing to this project. Or alt

caffeine.moe 20 Nov 13, 2022
Powerful, elegant and flexible test framework for Kotlin with additional assertions, property testing and data driven testing

Kotest is a flexible and comprehensive testing tool for Kotlin with multiplatform support. To learn more about Kotest, visit kotest.io or see our quic

Kotest 3.8k Jan 3, 2023
Integration Testing Kotlin Multiplatform Kata for Kotlin Developers. The main goal is to practice integration testing using Ktor and Ktor Client Mock

This kata is a Kotlin multiplatform version of the kata KataTODOApiClientKotlin of Karumi. We are here to practice integration testing using HTTP stub

Jorge Sánchez Fernández 29 Oct 3, 2022