Published in


Open Source Your Android Code — The Complete Guide

ADA | Adam Deconstructs Android


I will walk through each step of how I open sourced a CustomRippleView library for Android.

Place code inside an Android Archive Library (AAR) — Step 1 of 6

Besides open sourcing, AARs are useful when building multiple apps or versions with the same components.


  • Structurally the same as an Android app module
  • Includes source code, resource files, manifest (unlike JAR)
  • Compiles into Android Archive (AAR) rather than into APK
  • Post to some maven repository where devs can pull it as a dependency through Gradle (can also convert an app to a module)
  • Code Overlap — The app module will take precedence over a library if a resource ID is defined in both, library defined first will take precedence between libraries.


If you’re creating a standalone library outside an existing app you’ll want to both create a new project to host the library module as well as test the library module in an existing app.

include ':app', ':customrippleview'
compile project(":customrippleview")
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
... <application

  • Company domain: com.ebay.customrippleviewapp (needs to be a domain you own in order to get approved for open sourcing)
  • Package name: com.ebay.customrippleviewapp
<resources><public name="mylib_app_name" type="string"/><public name="mylib_public_string" type="string"/></resources>

Publish library publicly on GitHub with licensing and Docs — Step 2 of 6

Apache License 2.0 is one of the most popular, similar to the MIT License, but provides grant of patent rights from contributors to users. Apache 2.0 is commonly found in Android, Apache, and Swift.

git init
git add .git commit -m "Custom Ripple View"git remote add origin push -u origin master

Bintray and Sonatype Setup — Step 3 of 6

You only need to go through this painful steps once to setup your bintray account. Praise the lord! As this isn’t difficult, but the most annoying step.

Bintray Implementation

1. Create bintray account

gpg --gen-key
brew install gnupg gnupg2
gpg --list-keys
pub   rsa2048 2017-05-21 [SC] [expires: 2019-05-21]
uid [ultimate] Adam Hurwitz <>
sub rsa2048 2017-05-21 [E] [expires: 2019-05-21]
gpg --keyserver hkp:// --send-keys public_key_goes_here
gpg -a --export > public_key_sender.ascgpg -a --export-secret-key > private_key_sender.asc
less public_key_sender.ascless private_key_sender.asc
key code is here

Sonatype Implementation

This step requires filling a Jira ticket. If you thought you could escape Jira in your free coding time, you’re mistaken. It’s not too bad, as both times I’ve submitted a ticket they’ve approved it within the same day.

Prepare Project for Upload — Step 4 of 6

Prepare Library Module With Bintray

1. Add Jcenter and Maven dependency

tasks.withType(Javadoc).all {
enabled = false

Upload to jcenter— Step 5 of 6

Why is jcenter better than maven central?

  • Delivers library through CDN → faster loading
  • Largest Java Repository on earth
  • “Friendly” UI (perhaps in comparison)


1. Upload to bintray/jcenter (Once Sonatype Open Source Project Repository Hosting request is approved)

./gradlew install
./gradlew bintrayUpload
  • Deleting: Remove each version from bintray before removing the entire package.

Use In Project — Step 6 of 6

Declare the library in gradle and call the desired files.

  • Artifact_Id: customrippleview
  • Version: 1.0
compile 'com.ebay.customrippleview:customrippleview:1.0'




The (retired) Pub(lication) for Android & Tech, focused on Development

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