Repository navigation
feat(gradle-plugin): support Android library targets and AGP 8.x/9.x - #118
Open
aryapreetam wants to merge 1 commit into
Open
aryapreetam wants to merge 1 commit into
aryapreetam wants to merge 1 commit into
Conversation
aryapreetam
force-pushed
the
feat/android-library-support
branch
from
October 15, 2026 10:38
978d3bb to
8f95c98
Compare
aryapreetam
marked this pull request as ready for review
October 15, 2026 10:53
- Replace deprecated AppExtension/ApplicationVariant coupling with dynamic plugin detection - Support com.android.library and com.android.kotlin.multiplatform.library targets - Configure device test runner tasks and manifest generation for library modules - Enforce minSdk floor of 30 for Stories variant to support DEX 040 symbols - Disable check*AarMetadata tasks for stories execution to ensure compatibility across AGP 8.x and 9.x - Replace deprecated Project.exec and String.capitalized with ProcessBuilder and Kotlin stdlib - Add unit test suite covering application, library, and KMP library targets
aryapreetam
force-pushed
the
feat/android-library-support
branch
from
October 16, 2026 19:50
8f95c98 to
c6176fa
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Storytale currently has several limitations when used with modern Android projects:
com.android.applicationis supported. Multiplatform libraries usingcom.android.libraryorcom.android.kotlin.multiplatform.libraryfail during configuration.AppExtensionandApplicationVariantAPIs, causing deprecation warnings and incompatibilities on AGP 8.x and 9.x.val `Primary Button` by story) require DEX format 040 (Android API 30+). Projects withminSdk < 30fail during DEX compilation.project.execand internal Gradlecapitalized()extensions.Solution
1. Android Library & KMP Library Support
StorytaleGradlePlugin.ktandAndroidMultiplatformTask.ktdetect and configure both application and library targets..aarartifacts that cannot launch directly, the plugin configures an instrumented runner (androidTest/androidDeviceTest) with a generatedStorytaleAppActivitymanifest to host the gallery.mainStoriesSourceSet.kotlin.srcDirsinto the target source set using Gradle DSL (kotlin.srcDir(...)), avoiding temporary filesystem copies.2. AGP 8.x & 9.x Compatibility
AndroidComponentsHelper: Encapsulates variant resolution and device-test registration across AGP 8.x and 9.x APIs.beforeVariantsto elevateminSdkto 30 specifically for theStoriesvariant. This enables DEX format 040 for space-separated story names without modifying the user's releaseminSdk.check*AarMetadatatasks for stories tasks, preventing AGP 8.x from halting on advisoryminAgpVersionchecks when newer Compose dependencies specify AGP 9.1+.3. Modernized APIs
project.exec { ... }withProcessBuilderhelpers inUtils.kt.capitalized()with Kotlin stdlibreplaceFirstChar.AndroidSourceGeneratorTask.ktwith@get:OutputDirectoryand@get:OutputFile.Design Decisions
am starton their own. Executing through the device-test infrastructure packages a runnable APK containingStorytaleAppActivitywithout requiring a separate application harness module.Storiesvariant solves this cleanly without altering the user's release build configuration.HasDeviceTestsvsHasAndroidTest). Using targeted reflection avoids hard compile-time dependencies, allowing one plugin binary to support AGP 8.x and 9.x.Verification
./gradlew spotlessCheck(passes)./gradlew -p modules/gradle-plugin test(5/5 tests pass inAndroidTargetSupportTest)Visual Verification & Reproduction Steps
:examples)storytale-sample)examples-Stories.apkshared-androidTest.apkReproduction Steps
1. Internal Application (
:examples)2. External KMP Project with :shared library aryapreetam/storytale-sample
git clone https://github.com/aryapreetam/storytale-sample.git cd storytale-sampleshared/build.gradle.kts, apply the local snapshot:plugins { ... - id("io.github.aryapreetam.storytale") version "0.0.6" + id("org.jetbrains.compose.storytale") version "0.0.4-SNAPSHOT" }Note: Verified against CMP 1.10 profile (Kotlin 2.3.21) with zero configuration changes. (The following PR addresses compiler plugin FIR/IR compatibility for Kotlin 2.4+).