Publish an Android Library by JitPack

reference
JitPack is a novel package repository for JVM and Android projects. It builds Git projects on demand and provides you with ready-to-use artifacts (jar, aar).

Steps

1. Create an Android project and add a library module, here my library module name is mylibrary.

2. Add the android-maven plugin in your project/build.gradle

3. In your library/build.gradle add maven plugin and group setting

replace ‘your_github_name’ to your account

4. Upload this project to your github

5. Create a release tag

5–1. click the ‘releases’ tab
5–2. click ‘Draft a new release’
5–3. fill out the release information form then Publish release

6. Open JitPack and lookup your repository

6–1. paste your github repo url
6–2. click ‘Get it’ on the version you want
6–3. you can also use branch to get the latest code

7. Now you can get your library from JitPack!

Other Git Hosts

JitPack also works with other Git hosting providers. The only difference is the groupId of your artifacts:

  • BitBucket: org.bitbucket.Username:Repo:Tag
  • GitLab: com.gitlab.Username:Repo:Tag

Private Repos

Currently seems only github and bitbucket are works.(2017/03/06)

References

Example project on github