Gradle plugin for native library pack generation and runtime native-load redirection.
The plugin id is:
id("dev.oxyroid.native-load")- Reads
native-load.ymlfrom the root project. - For Android library modules, writes
BuildConfigfields that describe the active native pack. - For the configured Android application runtime variant, excludes selected
.sofiles from APK packaging. - Instruments configured package prefixes so native library loads are redirected to the configured owner/method.
- Registers
generate<Variant>NativePackstasks that extract native libraries from configured AAR artifacts and write zip assets plus a JSON manifest into the configured snapshot directory.
The host project must provide native-load.yml at the root. The schema currently supports:
instrumentation.packages: Java/Kotlin package prefixes to instrument.instrumentation.redirect.owner: JVM internal class name that owns the redirect method.instrumentation.redirect.method: redirect method name.distribution.repository: source repository name used by consumers.distribution.ref: source branch or ref used by consumers.distribution.snapshotDirectory: output directory, defaulting tonative-packs.distribution.runtimeVariant: Android build type to enable, defaulting torelease.distribution.producerProject: optional application project that generates packs.distribution.runtimeConfigProject: optional library project that receives runtimeBuildConfigfields.pack.id: pack id.pack.artifacts: non-transitive AAR artifact coordinates to extract.pack.libraries: native library names withoutlibprefix or.sosuffix.pack.loadOrder: optional load order, defaulting topack.libraries.pack.assetPrefix: optional generated zip prefix, defaulting tonative-pack.pack.manifestPrefix: optional generated manifest prefix, defaulting tonative-pack.
From the parent workspace root:
./gradlew :app:smartphone:generateReleaseNativePacks --no-configuration-cache
./gradlew :app:smartphone:tasks --all --no-configuration-cacheFrom this plugin directory:
../gradlew :native-load-gradle-plugin:buildgenerate<Variant>NativePacksresolves configured AAR artifacts non-transitively.- Native pack generation should be run with
--no-configuration-cacheuntil the task avoids execution-timeProjectaccess. - This plugin is intentionally small and focused on native pack workflows; avoid adding host-app-specific behavior here unless it belongs to the generic native-load mechanism.