Create a library available on Jitpack.io

suggest change

Perform the following steps to create the library:

  1. Create a GitHub account.
  2. Create a Git repository containing the library project.
  3. Add this to the library module build.gradle:
apply plugin: 'com.github.dcendents.android-maven'

...

// Build a jar with source files.
task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    failOnError  false
    source = android.sourceSets.main.java.sourceFiles
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    classpath += configurations.compile
}

// Build a jar with javadoc.
task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives sourcesJar
    archives javadocJar
}

Make sure that you commit/push the above changes to GitHub.

  1. Push the changes and create a GitHub release or tag.
  2. JitPack builds that tag when a project requests it. gradlew install only writes to the local Maven repository. It does not publish the library to JitPack.
  3. In the app that uses the library, add the JitPack repository and the dependency:
repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    compile 'com.github.[YourUser]:[github repository name]:[release tag]'
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents