Skip to content

Raise app compileSdk to the catalog's minor API level - #778

Open
dfabulich wants to merge 1 commit into
skiptools:mainfrom
dfabulich:compilesdk-37.1
Open

dfabulich wants to merge 1 commit into
skiptools:mainfrom
dfabulich:compilesdk-37.1

Conversation

@dfabulich

@dfabulich dfabulich commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Part of #776 (for #775, the Compose 1.13 bump). Companion PR: skiptools/skip-unit#30 (draft until this is released).

Compose 1.13 (BOM 2026.12.00) requires compileSdk 37.1. Its AAR metadata, and that of every module built against it, makes checkDebugAarMetadata fail for any app that compiles against plain 37:

Dependency ':skipstone:Showcase' requires libraries and applications that
depend on it to compile against version 37.1 or later of the
Android APIs.

:app is currently compiled against android-37.0.

Library modules get their compileSdk from skip-unit's skip.yml, and the companion PR changes that there. But every existing app's Android/app/build.gradle.kts, as generated by skip init, contains:

compileSdk = libs.versions.android.sdk.compile.get().toInt()

An integer can't express 37.1. And assigning compileSdk resets compileSdkMinor, so apps would have to edit their build scripts by hand.

This PR makes skip-build-plugin fill in the minor level instead:

  • If the libs version catalog has an android-sdk-compilePlatform version with a minor level (skip-unit adds "37.1"), the plugin registers an androidComponents.finalizeDsl action.
  • finalizeDsl runs after the app's android { } block has been evaluated. If the app's compileSdk equals the catalog's major level and the app hasn't set compileSdkMinor, the action sets compileSdkMinor to the catalog's minor level, so 37 becomes 37.1.
  • It leaves everything else alone:
    • An app that already uses compileSdk { version = release(37) { minorApiLevel = 1 } } is unchanged.
    • An app on a different major level (e.g. compileSdk = 36) is unchanged, and AGP reports its usual error if a dependency needs more.
    • An app that sets compileSdkMinor = 0 explicitly opts out.
  • Without the skip-unit change, the catalog has no android-sdk-compilePlatform entry, so this is a no-op.

This needs to be released before the skip-unit PR is merged. Once library modules compile against 37.1, AGP requires apps to do the same, even on the current Compose BOM. I checked with the skip-unit change, BOM 2026.05.01 and the released skip 1.9.23: checkDebugAarMetadata fails for all 19 of the showcase's Skip modules. With this plugin, it passes.

The plugin logs Skip: raising compileSdk from 37 to 37.1 at info level when it applies.

Alternatives considered

  • Fail with a "manual upgrade required" error telling users to edit app/build.gradle.kts. Simpler, but it breaks every existing app on upgrade.
  • Change the skip init template to the block form. We should probably do this too, but it only helps new apps.

Testing

I used swift package edit on skipapp-showcase with this branch, the skip-unit branch, and skip-model on BOM 2026.12.00 (Compose 1.13.1, material3 1.5.0, material3-adaptive 1.3.0). The app's build.gradle.kts was left unmodified.

  • gradle :app:checkDebugAarMetadata :app:assembleDebug passes and compiles the app against android-37.1. Without this change, checkDebugAarMetadata fails.
  • The Xcode build of the showcase (skip plugin plus Gradle) succeeds.
  • The edge cases above were checked by editing the app's android { } block: block-form 37.1, compileSdk = 36, and compileSdkMinor = 0.
  • skip-ui swift test on Compose 1.13.1 matches the baseline on released dependencies (compileSdk 37.0):
    • Robolectric: 335 tests, 309 passed, 0 failed, 26 skipped.
    • Android 17 emulator: 335 tests, 318 passed, 3 failed, 14 skipped. The same 3 TextTests size tests fail on the baseline too.

Notes

  • The plugin reads and writes compileSdkMinor, which needs AGP 8.12 or later. The companion skip-unit PR moves the catalog to AGP 9.3.3, the minimum Google lists for 37.1. An app that pins an older AGP in its own catalog while picking up the new skip-unit would fail here.
  • The plugin uses withGroovyBuilder so skip-build-plugin doesn't need a compile-time dependency on AGP.

Compose 1.13 requires compileSdk 37.1, but apps generated by skip init set compileSdk = libs.versions.android.sdk.compile.get().toInt(), which can't express a minor API level. When the version catalog has an android-sdk-compilePlatform entry like "37.1" (to be added by skip-unit), skip-build-plugin uses androidComponents.finalizeDsl to set compileSdkMinor on apps whose compileSdk equals that platform's major level and that haven't set a minor level themselves. An explicit compileSdkMinor = 0 opts out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant