Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.life-beam:gradle-android-command-plugin:1.7.1-lb1'
}
dependencies {
implementation("com.github.life-beam:gradle-android-command-plugin:1.7.1-lb1")
}
<dependency>
<groupId>com.github.life-beam</groupId>
<artifactId>gradle-android-command-plugin</artifactId>
<version>1.7.1-lb1</version>
</dependency>
libraryDependencies += "com.github.life-beam" % "gradle-android-command-plugin" % "1.7.1-lb1"
:dependencies [[com.github.life-beam/gradle-android-command-plugin "1.7.1-lb1"]]
Use gradle tasks to run specific adb
commands.
You can use this plugin to do things such as:
This is particularly useful for CI servers but could be used to speed up development as well.
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'
}
}
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.
Here are a list of useful links:
support-android-command
when posting a new question