Quick distribution of your library in less than 10min

If you don’t like to distribute your Library or SDK using JCenter or you’re looking to avoid  the process of signing and publishing in JCenter ,so JitPack may be the best one to pick and try , JitPack is an easy to use package repository for JVM and Android .

The only thing you need is a Github account , with your Github account you don’t even need to register a new account,

once logged It automatically fetch all your repo from Github.

JITPACK documentation says:

If you want your library to be available to the world, there is no need to go through project build and upload steps. All you need to do is push your project to GitHub and JitPack will take care of the rest. That’s really it!❞

 

I just created a simple android library and pushed to Github ,then logged into JitPack and amazingly I see my library ready to be published with two url of maven dependency  to be added to my project!

Well JitPack precise clearly that as long as you publish your Library as public repo the service is free , otherwise (for private repo ) you should pay!

Here is what I’ve seen just after logging into JitPack and select my GitHub Library project :



As you can see , the published dependency url is formatted as:

dependencies { compile 'com.github.domainname:libraryname:-SNAPSHOT' }

or 

dependencies { compile 'com.github.domainname:libraryname:master-SNAPSHOT' }

here my account name is used as domain name so my full domain url is :

'com.github.domainname’ 

and  My library name  is  libraryname (here in my example SidebarExample)

 Remind :

The global  path for distributed  Libraries  are as following

compile 'yourGroupId:LibraryName:x.y.z'

or

compile 'GroupId:ArtifactId:version'

example:

compile 'com.android.support:appcompat-v7:25.0.2'

 

which

'com.android.support = Group ID
appcompat-v7 = Library Name
and x.y.z  = version = 25.0.2


This Library is just for example , it’s a Sidebar(Custom Drawer) library , you can add this to a simple Activity based project , like this:

public class MainActivity extends AppCompatActivity {

    @Override    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);  
        setContentView(R.layout.activity_main);

        //remove if any previous instance
        
SidebarView.getInstance().removeView();  
  }

    @Override    public void onStart(){
        super.onStart();

      CustomView sidebarInfo = new CustomView();
      sidebarInfo.setHandleImageInOpen(R.drawable.chevron_ferme);

      sidebarInfo.setHandleImageInClose(R.drawable.chevron_ouvrir);
      sidebarInfo.setContentLayout(R.layout.sidebar_content);
      SidebarView.getInstance().startSidebar(this,sidebarInfo);

    }

}

If you compile and run this example , a Sidebar is created on right side of your activity.

SNOPSHOT is an pre-versioning indicator during development stage , when your Library or SDK is still under development SNAPSHOT , In fact it’s a version for debug mode , Once Your library is published you should remove SNAPSHOT and provide a real version like this 

dependencies { compile 'com.github.domainname:libraryname:1.0' }

Important : For release version don’t forget to change status to Release in Git

Optional:

During debug your SNAPSHOT version is cached by Gradle , if you want to pick the latest fresh version just add this configuration to your build.gradle:

configurations.all {

resolutionStrategy.cacheChangingModulesFor 0, 'seconds'

 }

JitPack is secured and  communication with server is done over HTTPS.

For more information :

https://jitpack.io

 

Khosrov

March 13, 2017

 

 © Xosrov 2016