Publish an Android Library by GITLAB

Muhammad Bilal
2 min readMar 22, 2020

--

You have created an awesome android library and want to publish it with Gitlab then nothing to worry about. You are in the right place. You are going to learn how you can resolve gradle library dependency.

Gitlab itself does not support publishing of android library so we will use jitpack.io for publishing our library.

Let’s assume that you have successfully build android library project in Android Studio and hosted it on Gitlab.com

First you need go to gitlab Settings -> Access Tokens and create personal access Token

In Next Step, Go to https://jitpack.io and go to Settings page after registration. Paste gitlab access token and click on refresh icon in front of Access Token. This access token will be use in your gradle file.

Now create and push a TAG in Gitlab project and lookup your repository in JitPack

let’s configure it.

Go to /gradle.properties and add the access token you copied from jitpack settings.

authToken=jp_hjhggfhgfvdbhfsdhg32

Now add it in your root level build.gradle file

allprojects {
repositories {
...
maven {
url "https://jitpack.io"
credentials { username authToken }
}
}
}

In last step , add your dependency in build.gradle

{
implementation 'com.gitlab.BilalSiddiqui:AddressPicker:0.1.0'
}

Congratulations ! That’s all.

--

--

Muhammad Bilal
Muhammad Bilal

Responses (2)