Plugin will upload apk to distribution system after building release artifact.
In the gradle folder, copy samples->customPlugin->plugin to your work directory. Gradle distribution can be downloaded here
Change build.gradle to this strusture
Configure plugin and deploy to local folder
Rename and change plugin description file under src->main->resources->META-INF->gradle-plugins folder
File Name: com.tunebrains.beta-gradle-beta-upload.properties
Create groovy class com.tunebrains.beta.gradle.UploadApkPlugin
Specify folder to deploy plugin
Execute gradle tast to upload archive. Refresh gradle task if required.
Apply plugin in your Android project.
In top level build.gradle
In app level build.gradle
Its time for write some code.
We will add custom tasks betaDebug and betaRelease to upload debug and release apks.
To perform multipart post add apache dependencies to build.gradle
To get resulting apk for upload we can use task field
Now we need to post our resulting apk to server endpoint.
In result of evecution uploadApk we got the resulting json object of parsed server response. And can for example print to console url where you can find the build.