Skip to content

Migrate workout-logger/android to AGP 9.0+ for built-in Kotlin / new DSL support #60

Description

@coderabbitai

Summary

Follow-up to #59: migrate workout-logger/android to Android Gradle Plugin (AGP) 9.0+ to actually activate the android.builtInKotlin and android.newDsl gradle.properties flags that were added automatically by the Flutter migrator in #59. On the current AGP version (8.11.1), these flags are inert placeholders because Flutter's Gradle plugin only enables built-in Kotlin support when AGP major version >= 9.

Background

  • workout-logger/android/gradle.properties sets android.builtInKotlin=true and android.newDsl=true, but Flutter's Gradle plugin (FlutterPluginUtils.isBuiltInKotlinEnabled) explicitly forces this to false when AGP major version < 9.
  • The project currently pins com.android.application and org.jetbrains.kotlin.android to 8.11.1 / 2.2.20 in workout-logger/android/settings.gradle.kts.
  • Official AGP compileSdk compatibility tables list API level 37 (already targeted in Feat/android 17 #59) as requiring minimum AGP 9.1.1, not just 9.0.1.

Required changes

  1. workout-logger/android/settings.gradle.kts

    • Bump com.android.application plugin version to 9.1.1+ (not just 9.0.1, due to compileSdk 37 compatibility requirements).
    • Remove the org.jetbrains.kotlin.android plugin declaration entirely — AGP 9's new DSL is not compatible with the standalone Kotlin Android plugin; built-in Kotlin support handles this instead.
  2. workout-logger/android/gradle/wrapper/gradle-wrapper.properties

    • Bump Gradle distribution to >= 9.1.0 (AGP 9.0's minimum Gradle requirement).
  3. workout-logger/android/app/build.gradle.kts

    • Rewrite the ABI-specific versionCodeOverride logic, currently implemented via the legacy android.applicationVariants.configureEach { ... } API (casting output to ApkVariantOutputImpl), using the new androidComponents.onVariants(...) variant API. This is the biggest non-trivial code change required.
    • Migrate the kotlinOptions { jvmTarget = ... } block to the built-in-Kotlin equivalent DSL (e.g., kotlin { compilerOptions { jvmTarget = ... } }), verifying against Flutter's built-in Kotlin migration docs at the time of the upgrade.
  4. Compatibility verification (risk items, not pure version bumps)

    • Confirm Flutter's flutter-gradle-plugin (pinned via Flutter SDK 3.44.4+ per Feat/android 17 #59) has stable-channel support for AGP major version 9 before committing to the bump.
    • Re-verify the F-Droid signing-block-stripping logic in app/build.gradle.kts (the comment about signingConfig needing to stay on one line) still holds under the new DSL/variant API.

Affected files

  • workout-logger/android/settings.gradle.kts
  • workout-logger/android/gradle/wrapper/gradle-wrapper.properties
  • workout-logger/android/app/build.gradle.kts
  • workout-logger/android/gradle.properties (flags already in place from Feat/android 17 #59, will become active)

Acceptance criteria

  • AGP bumped to 9.1.1+ in settings.gradle.kts, org.jetbrains.kotlin.android plugin declaration removed.
  • Gradle wrapper bumped to >= 9.1.0.
  • android.applicationVariants.configureEach ABI versionCode logic migrated to androidComponents.onVariants(...).
  • kotlinOptions.jvmTarget migrated to the built-in-Kotlin equivalent.
  • Flutter Gradle plugin / Flutter SDK version confirmed compatible with AGP 9 on stable channel.
  • F-Droid build (signing block stripping) verified to still work correctly.
  • CI (.github/workflows/release.yml, .github/workflows/test.yml) confirmed to require no changes (JDK 17 already set via actions/setup-java@v4).

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions