Skip to content

Migrate Android plugin to built-in Kotlin (#94) - #98

Merged
felnanuke2 merged 2 commits into
felnanuke2:masterfrom
Coolcatss:migrate-built-in-kotlin
Oct 7, 2026
Merged

felnanuke2 merged 2 commits into
felnanuke2:masterfrom
Coolcatss:migrate-built-in-kotlin

Conversation

@Coolcatss

Copy link
Copy Markdown
Contributor

Fixes #94, following the plugin-author migration guide.

  • android/build.gradle: no longer applies kotlin-android or puts kotlin-gradle-plugin on the buildscript classpath; kotlinOptions becomes kotlin { compilerOptions { jvmTarget } }; the kotlin-stdlib-jdk7 dependency is dropped.
  • pubspec.yaml: minimum Flutter 3.44 / Dart 3.12, as the guide requires.
  • CHANGELOG.md: entry added.

Tested

A Flutter 3.47.4 app on AGP 9.0.1 with android.builtInKotlin=true, using this branch as a path dependency: flutter build apk --debug succeeds, prints no KGP warning, and GoogleCastPlugin is in the APK's dex.

Not tested

  • The plugin's own example app (it still applies KGP and would need migrating separately, per the guide).
  • Casting on a device.
  • Note for consumers: with android.builtInKotlin=false this plugin's Kotlin sources are no longer compiled (the build then fails on GoogleCastPlugin not found), so apps need built-in Kotlin enabled, as the guide describes.

Bumping the SDK constraint to ^3.12.0 raises the language version,
so 'dart format' (tall style) now reformats 66 files. Required for
the CI 'Verify formatting' step.

@felnanuke2 felnanuke2 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — Migrate Android plugin to built-in Kotlin (#94)

Verdict: changes look correct. ✅ Matches the official plugin-author migration guide point by point:

  • Removes the KGP classpath + kotlin-android apply + kotlin-stdlib-jdk7 dependency — correct.
  • kotlinOptions → kotlin { compilerOptions { jvmTarget = JVM_11 } } using the type-safe DSL — correct replacement.
  • SDK floors (dart: ^3.12.0, flutter: >=3.44.0) match the minimums the migration requires, and the CHANGELOG documents it.

Verified locally (Flutter 3.44.2 stable, same as CI): flutter analyze clean, 306/306 tests pass.

CI failure fixed 🔧

The test job was failing on "Verify formatting": bumping the SDK constraint raises the language version to 3.12, which switches dart format to the tall style — 66 files needed reformatting. I pushed 5f8c5d7 applying exactly that reformat (no logic changes; all files still analyze clean and tests pass).

Non-blocking suggestions

  1. android/build.gradle still has sourceSets { main.java.srcDirs += 'src/main/kotlin' } — redundant with built-in Kotlin (already includes src/main/kotlin); can be dropped.
  2. The example app itself still applies KGP (kotlin-android, kotlinOptions, kotlin-stdlib-jdk7). Allowed for host apps today, but worth migrating eventually to stay ahead of the same deprecation.
  3. Raising the minimum SDK is a breaking change for consumers — consider releasing this as 2.0.0 rather than a 1.x patch/minor.

@felnanuke2
felnanuke2 merged commit f8cbb14 into felnanuke2:master Oct 7, 2026
4 checks passed
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.

Migrate Android plugin to Flutter built-in Kotlin

3 participants