A Gradle plugin for Android projects that converts APK files to JAR libraries and automatically adds them as compile only dependencies to your project.
Due to the resource-intensive nature of APK processing, it's recommended to allocate at least 4GB of memory to Gradle:
Add the following to your gradle.properties
file:
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
Add the jitpack.io repository to settings.gradle
pluginManagement {
repositories {
...
maven(url = "https://jitpack.io")
}
resolutionStrategy {
eachPlugin {
if (requested.id.toString() == "dev.marcelsoftware.apklink-gradle") {
useModule("dev.marcelsoftware:ApkLink-Gradle:${requested.version}")
}
}
}
}
Apply the plugin in your build.gradle.kts
id("dev.marcelsoftware.apklink-gradle") version "1.0.2"
Configure the plugin in your build.gradle.kts
apklink {
// Configuration goes here
}
Using a local apk file
apklink {
apkFile = file("path/to/your/app.apk")
// Optional: specify a custom output location for the JAR
outputFile = file("${buildDir}/libs/app.jar")
}
Downloading from APKPure
apklink {
apkpure {
packageName = "com.example.app"
// Optional: specify a specific version
version = "1.2.3"
}
}
Downloading from a URL
apklink {
url {
url = "https://example.com/download/app.apk"
// Optional: specify a custom filename
fileName = "app.apk"
}
}
MIT License
This plugin uses dex2jar for APK to JAR conversion.