Skip to content

Flutter plugin: migrate Android build to built-in Kotlin #215

Description

@aleclarson

Hi! Thanks for maintaining Pulsar.

An application using pulsar_haptics 0.1.0 with Flutter 3.44.x reports:

WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): pulsar_haptics
Future versions of Flutter will fail to build if your app uses plugins that apply KGP.

This is not blocking current builds, but Flutter is warning that KGP application will no longer be supported in a future release / with AGP 9.

The current Flutter Android build still contains:

  • the Kotlin Gradle Plugin classpath in the buildscript block (lines 4–14)
  • id("kotlin-android") and id("org.jetbrains.kotlin.plugin.serialization") (lines 24–28)
  • the legacy kotlinOptions block (lines 65–67)

Would you consider migrating the Flutter plugin to built-in Kotlin? The official Flutter guide recommends:

  1. For a release that raises the minimum Flutter version to 3.44 / Dart 3.12, remove the KGP plugin declarations and legacy kotlinOptions, then configure the JVM target through the built-in kotlin.compilerOptions DSL.
  2. If older Flutter versions must remain supported, conditionally apply org.jetbrains.kotlin.android only for AGP versions below 9, following the compatibility section of the guide.
  3. Remove the serialization Gradle plugin if it is no longer needed by the Flutter Android source, and verify the plugin example with AGP 9 and android.builtInKotlin=true.

Guide: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors

There should be no Dart API change required. We would be happy to verify a release candidate. Thanks!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions