All Projects → nisrulz → Uploadtojitpack

nisrulz / Uploadtojitpack

Licence: apache-2.0
[Example] Base repository to demonstrate the process of uploading an aar/jar to JitPack

Programming Languages

java
68154 projects - #9 most used programming language

Upload to JitPack

Specs

Featured in

AndroidDev Digest

Show some ❤️

GitHub stars GitHub forks GitHub watchers GitHub followers
Twitter Follow

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.

    • Goto File>Project Structure..
    • Select app module in the sidebar
    • Select the Dependencies tab
    • At the bottom is a + icon, click that and select Module dependency and select your library module.
    • 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:4.1.1'
    
      ..
    
      // Setup the android-maven-gradle-plugin in the classpath
      classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
      ..
    
  7. 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'
    
  8. Create a release TAG in git

    git tag -a 1.0 -m "v1.0"
    git push origin 1.0
    
  9. 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.

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

    screenshot1

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

    screenshot2

    Selectable code

    repositories {
      google()
      jcenter()
      maven { url https://jitpack.io” }
    }
    dependencies {
      compile 'com.github.nisrulz:awesomelib:1.0'
    }
    
  12. 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 appreciate my work, consider buying me a cup of ☕️ to keep me recharged 🤘 [PayPal]

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].