# Gradle

Updraft allows even faster application deployment with the Updraft Gradle Plugin. Android Studio uses Gradle, a build toolkit to automate and manage the entire build process. Gradle can be flexibly expanded and configured by yourself.\
Integrate the Gradle Updraft plugin into your Android code. The tested and signed builds are then uploaded directly to Updraft where you can easily manage the distribution of the beta app to your beta-testers.

There are a number of sub-sections on this page:

* [Instruction to integrate Updraft Gradle](#instructions)
* [Usage of Gradle Plugin](#usage-of-gradle-updraft-plugin)

## Instructions 🚀

1. Add the code below to you `build.gradle` file in the `app` folder.

```
buildscript {
 repositories {
   ...
   mavenCentral()
 }
 
 dependencies {
   ...
   classpath 'com.appswithlove.updraft:updraft:2.1.5'
  }
 }
```

2\. Apply the plugin in `build.gradle` in `app` folder (same file as before).

```
apply plugin: 'updraft'
```

3\. Add one or multiple `updraftUrls['YOURPRODUCTFLAVOUR']` wrapped in `updraftExtension` to the file. \
\
In order to get the needed url, go to the Edit Panel of your Updraft App and get the *https\:// url* part of the `curl` command. (e.g. <https://getupdraft.com/api/app_upload/.../.../>).&#x20;

The part `YourBuildVariant` should be replaced by the exact name your build variant. For example:

```
updraftExtension {
  updraftUrls['YourBuildVariant'] = [".../your/staging/url/"]
  updraftUrls['ProdRelease'] = [".../your/prod/url/", ".../your/prod2/url/"]
}
```

4\. Done!

## Usage of Gradle Updraft Plugin

After installing the plugin, you should be able to find the Gradle Updraft tasks in Android Studio. The naming is always `updraft` + buildVariant. The appropriate url will be choosen as destination. There is 1 task for every available buildVariant.\
&#x20;`"Gradle Project" Window -> Tasks -> Other -> updraft... (e.g. updraftStagingRelease)`\
&#x20;In order to use them, make sure that you build the project *before*.

Otherwise, you can call the gradle tasks via command:

```
./gradlew updraftStagingRelease
```

Or combined with clean + assemble:

```
./gradlew clean assembleStagingRelease updraftStagingRelease
```

## Get the Updraft Gradle Plugin

You can find the plugin on our Github Page: <https://github.com/appswithlove/updraft-plugin-android>
