An Android-Gradle plugin for generate DEX classes and a APK from a Library module.
An Android-Gradle plugin for generate DEX classes and a APK from a Library module.
Well, if you reach this page, you are very likely looking for this. In my case, I was on the need to perform hot-code Android updates pushed from my server without forcing the users to update the app from the PlayStore.
This library relies on the Android's build stack, and given a Library module:
classes.jar
and perform dexing on it using the dx
tool.classes.dex
along with all original Java resources from classes.jar
into an mymodule.lib.apk
fileNote: This tool will allow you to push updates of Java (Android) code and Java resources. Android's resources (strings, drawables, etc) or any other Android specific component are not supported.
On your build.gradle
add:
plugins {
id 'com.github.gmazzo.apklib' version '0.3'
}
apply plugin: 'com.android.library'
After applying the plugin, a task bundleLibApk
per variant will be added to your build.
On a default configuration will be bundleLibApkDebug
and bundleLibApkRelease
.
Check the provided example-app
and example-lib
for a full working example of this library with hot-code loading.
You may easily replace the content from the asset with the response from a web endpoint.
This repository also serves as an example of: