Publishing Gradle AAR libraries is one of the bigger pain points with Android’s new build system - it’s not as integrated and direct as it is with the Maven build system. Pretty much anyone has his/hers own solution to this problem and here is mine based on published FuzzyDateFormatter library.
1. Generate JavaDoc and source JARs
Both Maven Central and jCenter require you to publish a JavaDoc and Source JARs for your public projects. We’re going to use android-maven-plugin to generate those.
Add required build dependencies to your top-level build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
To actually upload the artifact you need to create a BinTray.com account. After you create it, you’ll have repository maven created by default. Now you just need to get your API key - click on your username -> API key.
Then add required data to your local.properties file:
bintray.user=<your bintray username>
bintray.apikey=<your bintray API key>
After that you can upload and publish the artifact by simply running
The first time you publish your library, you’ll have to open the BinTray site, click on your package and click on Maven Central. This will requiest a review and public listing of your library on jCenter repository.