Creating an Android library using Android Studio

As an Android developer, we use a lot of third parties libraries which are available on Github and it’s easy.It saves our time and reduces the complexity of the code.It’s fun to use.But have you ever thought of creating one for yourself? if yes, then you are at the right place.

Let’s start!

1.Create a package on Bintray

First of all. You need to create a package on bintray. To do so, you need a bintray account and create a package on the website.

  • Register for an account on (Follow the instructions)


  • Once registration is completed, login to the website and click on Add a new repository 


  • In repository, input name as maven(we can give any name)  and select type as maven
  • We can select license also like apache etc
  • Click on Create


  • Click on Add New Package to start creating a new package for our library.


  • Enter all of that required information


  • Although there is no rule on how to name the Package Name but there is some name convention. Just set all of the characters to lowercase and separate each word with a hyphen (-), for example, library. Once every required field is done, click on Create Package to finish.
  • The website will redirect you to Edit Package page. Click at package’s name under Edit Package text to enter package’s details page.


  • Done! We now have our own Maven Repository on Bintray which is ready to be uploaded the library.


2.Create an android studio project

  • Create a new project in Android studio
  • Give your project name and click finish
  • Again go to File>New>New module


  • Select android library


  • Give your android library name


  • Click finish
  • Now go to build.gradle(Project) and add these dependencies
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'


dependencies {
        classpath ''
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
  • Again come to build.gradle(library) and add and modify according to your data
ext {
    bintrayRepo = 'maven'
    bintrayName = 'LogR'

    publishedGroupId = 'com.colorssoftware.library' //this is GROUPID
    libraryName = 'library' //this is your library name
    artifact = 'library' //this is ARTIFACTID

    libraryDescription = 'A login and registration library for android'

    siteUrl = ''
    gitUrl = ''

    libraryVersion = '1.0.0' //this is version name

    developerId = 'braj24'
    developerName = 'Braj Bhushan Singh'
    developerEmail = ''

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = ''
    allLicenses = ["Apache-2.0"]
  • then add this at the bottom
apply from: ''
apply from: ''

We will discuss something about ARTIFACT_ID, GROUP_ID and VERSION

Let’s take one famous library, Picasso

compile 'com.squareup.picasso:picasso:2.5.2'

In this library,

com.squareup.picasso - GROUP_ID
picasso -  ARTIFACT_ID
2.5.2 -  VERSION 

It is written as compile ‘GROUP_ID: ARTIFACT_ID: VERSION’

  • Now open Location)
  • and put
bintray.user=your bintary username
bintray.apikey=your api key(we can get this bintray profile settings)

  • Now open android studio terminal
  • Run

./gradlew install 


  • Again run

./gradlew bintrayUpload


  • After some time it will show BUILD SUCCESSFUL
  • And we are done.
  • Now open bintary repository.we will get all the details like version no.Click on version no.All the files will be available in file tabs.


  • At last click on Add to jcenter and in another tab just click send(no comment is required)


  • After 3-4 hours we will get one email like we can use our library after verification from bintray.


  • Now we can use our library as compile ‘GROUP_ID: ARTIFACT_ID: VERSION


Happy coding!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s