Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

vi-technologies/gradle-android-command-plugin

 
 

Repository files navigation

gradle-android-command-plugin

Bintray

Use gradle tasks to run specific adb commands.

Description

You can use this plugin to do things such as:

  • Find all devices attached and get basic info about them
  • Select the first one that complies with a custom rule
  • Install a specific APK from the available build types + flavours
  • Clear preferences or do something related to the APK to prepare for tests
  • Run monkey for that specific APK on that specific device
  • Uninstall the APK

This is particularly useful for CI servers but could be used to speed up development as well.

Adding to your project

To start using this library, add these lines to the build.gradle of your project:

apply plugin: 'com.android.application'
apply plugin: 'com.novoda.android-command'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.novoda:gradle-android-command-plugin:1.7.1'
    }
}

Simple usage

The plugin creates new tasks that you can use:

  • installDevice<Variant> [com.novoda.gradle.command.InstallDevice] - installs the app on a specific device.
  • uninstallDevice<Variant> [com.novoda.gradle.command.UninstallDevice] - uninstalls the app from a specific device.
  • run<Variant> [com.novoda.gradle.command.Run] - installs and launches the app on a specific device.
  • start<Variant> [com.novoda.gradle.command.Run] - launches the app on a specific device (without installing it).
  • stop<Variant> [com.novoda.gradle.command.Stop] - Forcibly stops the app on a specific device.
  • monkey<Variant> [com.novoda.gradle.command.Monkey] - installs and runs monkey on a specific device.
  • clearPrefs<Variant> [com.novoda.gradle.command.ClearPreferences] - clears app preferences on a specific device.
  • com.novoda.gradle.command.Input - runs input scripts, wrapping adb shell input.
  • com.novoda.gradle.command.Files - enables basic file copy via push and pull, wrapping the respective adb calls.

For advanced usage please take a look into the sample project build.gradle file.

Links

Here are a list of useful links:

  • We always welcome people to contribute new features or bug fixes, here is how
  • For more info on how start working on this project, see this wiki page
  • If you have a problem check the Issues Page first to see if we are working on it
  • For further usage or to delve more deeply checkout the Project Wiki
  • Looking for community help, browse the already asked Stack Overflow Questions or use the tag: support-android-command when posting a new question

About

Handy commands for testing Android on CI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 91.3%
  • Java 8.7%