Android Application Development: Publishing your Android library to JCenter

buildscript { ext.androidToolsVersion = '3.0.1'    
ext.mavenPlugin = '2.0'
ext.jfrogVersion = '1.8.0'

repositories {
dependencies {
classpath "$androidToolsVersion"
classpath "com.github.dcendents:android-maven-gradle-plugin:$mavenPlugin" classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$jfrogVersion"
apply plugin: ''
apply plugin: 'maven'
android {
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
version 'my-project-version-name' //example 1.0.0
group 'my-group'
ext.bintrayUser = "my-bintray-username"
ext.bintrayApiKey = "my-bintray-apikey"
publishing {
publications {
Production(MavenPublication) {
artifactId 'myartifactid'
version this.version
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included in the pom.
if ( != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('version', it.version)
bintray {
user = "$bintrayUser"
key = "$bintrayApiKey"
override = true
publications = ['Production']
pkg {
repo = 'my-bintray-repo-name'
userOrg = "my-bintray-organization-name"
name = 'my-library-name'
description = "description of my library"
publish = true
publicDownloadNumbers = true
licenses = ['MIT'] *if your licenses are different, specify that here
vcsUrl = 'my-source-control-repo-url'
dryRun = false
version {
name = this.version
desc = "${this.version}"
released = new Date()
vcsTag = this.version
dependencies {
apply from: 'publish.gradle'
** Windows Users **
gradlew clean
gradlew assembleRelease
gradlew bintrayUpload
** Mac Users **
./gradlew clean
./gradlew assembleRelease
./gradlew bintrayUpload




I am a mobile engineer, specializing in Android.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium


Point-And-Click Movement In Unity

Divide and rule: diversity of tools to manage a project

Kubernetes Native or Cloud Native? — Which one to choose.

Deployment Is Not Release, Let’s Use Feature Flags

Agility Requires a Broader Understanding of the Agile Manifesto

Ship and run .Net

LeetCode 3. Longest Substring Without Repeating Characters

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matthew Perkins

Matthew Perkins

I am a mobile engineer, specializing in Android.

More from Medium

Introducing Android 12

5 Tips To Speed Up Android App Development

Android 13: Notification Runtime Permission

Simple custom shadow on Android