Add snippet below to your root build script file.
buildscript {
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath "com.github.ab180:fatjar:{$tag}"
}
}
Add snippet below to the build.gradle
of your android library:
apply plugin: "co.ab180.fatjar"
Change implementation
or api
to internalize
while you want to embed the dependency in the library.
dependencies {
// Local dependency
internalize files("fantastic_library.jar")
// Remote dependency
internalize "com.google.code.gson:gson:1.+"
// When 'transitive=true' is needed
internalizeAll "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.+"
}
FatJar currently support
.jar
extension under thecom.android.library
plugin only
Add repackage scope into build.gradle
file.
repackage {
def prefix = "com.mycompany"
relocate "com.google.gson.**", "${prefix}.com.google.gson.@1"
relocate "kotlin.**", "${prefix}.kotlin.@1"
}