UploadToJitpack

Additional

Language
Java
Version
N/A
Created
Jun 27, 2016
Updated
Jul 25, 2017
Owner
Nishant Srivastava (nisrulz)
Contributor
Nishant Srivastava (nisrulz)
1
Activity
Badge
Generate
Download
Source code

Announcement

Upload to JitPack

Specs

Featured in

Show some ❤️


Base repository to demonstrate the process of uploading an aar/ jar to JitPack.

Blog Post : Guide to publishing your Android Library via JitPack

The process is as follows

  1. Create an Android project or open an existing one in Android Studio

  2. Init the project with git and also create a repo on Github for the same. Each step here onwards represent a commit and should be pushed to github.

  3. Create and add a new module and choose Android Library.

    Goto File>New>New Module.. and select Android Library.

  4. Implement your library code inside the library module you created in the last step.

  5. Next add the library module as a dependency to the app module.

    1. Goto File>Project Structure..
    2. Select app module in the sidebar
    3. Select the Dependencies tab
    4. At the bottom is a + icon, click that and select Module dependency and select your library module.
    5. Press apply or ok.
  6. Once project is synced, add the android-maven-gradle-plugin to classpath in build.gradle file at root project level.

 dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    ..
    ..
    // Setup the android-maven-gradle-plugin in the classpath
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
    ..
  1. Next, apply the android-maven-gradle-plugin to the build.gradle file at library module level. Also add the group variable.
 apply plugin: 'com.android.library'

 // Required plugin in library module
 apply plugin: 'com.github.dcendents.android-maven'

 // Replace nisrulz with <your_github_username>
 group='com.github.nisrulz'
  1. Create a release TAG in git
git tag -a 1.0 -m "v1.0"
git push origin 1.0
  1. Once everything is pushed and the release TAG is also pushed, goto https://www.jitpack.io/#username/reponame where replace username with your github username and reponame with the reponame of the android project.

  2. Select the release you would like to share by clicking the ‘Get It’ button next to the list of releases of your repository.

  1. Next the same page at Jitpack would show you how to use the library in your other android projects. Something like below

Selectable code

repositories {
    jcenter()
    maven { url “https://jitpack.io” }
}
dependencies {
    compile 'com.github.nisrulz:awesomelib:1.0'
}
  1. Let the world know of your AwesomeLib 😄
  • Add a readme that explains how to integrate and use your Awesome library
  • Add a license block as in this repo
  • Also include the JitPack badge provided by jitpack in your readme
  • Promote your lib on social media so that others can know about it.
  • Always add a working sample app in your project that demonstrates your library in use.
  • Add screenshots if possible in your readme.

If you found this example helpful or you learned something today and want to thank me, consider buying me a cup of ☕️

  • PayPal
  • Bitcoin Address: 13PjuJcfVW2Ad81fawqwLtku4bZLv1AxCL

License

Copyright 2016 Nishant Srivastava

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.