Release your Android library in modular way with Jitpack

Alperen Babagil
2 min readSep 23, 2020

Hi everyone 🙋‍♂️ In this article I will give a little hint that can save you from angry hours and smashing your keyboard 😁 If your module cannot be found by gradle sync you are at the right article.

🤔

When you intend to publish your awesome library you may want to distribute of its one module as one library. For example if you are making a image loader library you may want seperate image filter features from main library. Or image transformation or image animation…

I will not write about publishing an Android library on Jitpack, if you are reading this you must know how to do it. But I’m dropping some links about it:

Get to the point

First you must write this

classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

at the buildscript -> dependencies section at the project level build.gradle file

Project level build.gradle file

You must enter this code to every module’s build.gradle file.

apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.your_github_name'

Under the

apply plugin: 'com.android.library'
One of the module build.gradle files

The key point is every module even “app” module.

After that jitpack recognizes your module name and you can use your module at other libraries as:

implementation 'com.github.alperenbabagil.cleanappbase:cabdata:0.0.6'

In above code cleanappbase is the project that includes other modules and demo app. ‘cabdata’ is a module that we want to use only. Last point is you must use “.” instead of “:” before the project name. Only last two punctiation must be “:”

Happy coding 🎉

--

--