Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.jitpack-io:android-jitpack-library-example:1.5'
}
dependencies {
implementation("com.github.jitpack-io:android-jitpack-library-example:1.5")
}
<dependency>
<groupId>com.github.jitpack-io</groupId>
<artifactId>android-jitpack-library-example</artifactId>
<version>1.5</version>
</dependency>
libraryDependencies += "com.github.jitpack-io" % "android-jitpack-library-example" % "1.5"
:dependencies [[com.github.jitpack-io/android-jitpack-library-example "1.5"]]
A example of a Jitpack integration with a library with multiple product flavours:
All variants are built and published with different filenames:
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.jitpack-io:android-jitpack-library-example:1.5:productionRelease@aar'
compile 'com.github.jitpack-io:android-jitpack-library-example:1.5:sandboxRelease@aar'
compile 'com.github.jitpack-io:android-jitpack-library-example:1.5:sandboxDebug@aar'
compile 'com.github.jitpack-io:android-jitpack-library-example:1.5:productionDebug@aar'
}
The default variant is 'productionRelease' and is set using the defaultPublishConfig property:
dependencies {
compile 'com.github.jitpack-io:android-jitpack-library-example:1.5'
}