workmanager_android: guarded apply plugin: 'kotlin-android' is the pattern Flutter says will stop building (flutter/flutter#189770)

オープン
#743 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

  • #744 @kuhyx による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, dart, kotlin

調査の方向性

Start with workmanager_android's android/build.gradle and compare its guarded Kotlin plugin application with FlutterPluginUtils behavior for the supported Flutter versions. Remove the obsolete guarded pattern if compatibility checks support it, retain the existing compilerOptions block, and run the issue's Flutter 3.47.5 Android build reproduction to confirm the warning is gone.

索引モデルが issue の本文から書いたものです。

説明

Version

Technology Version
workmanager 0.10.10
workmanager_android 0.10.9
Flutter 3.47.5 (6a19cca564)
Android Gradle Plugin 9.4.1
Gradle 9.7.1

Describe the error

With android.builtInKotlin=true in the app's gradle.properties, every Android build prints:

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

At runtime the plugin does not apply KGP: the guard added in #721 / #722 skips it. I checked with an init script over every project, and plugins.hasPlugin('org.jetbrains.kotlin.android') is false for workmanager_android. The warning comes from Flutter's detectApplyingKotlinGradlePlugin, which regex-matches the guarded apply plugin: 'kotlin-android' line in android/build.gradle.

This isn't a Flutter bug they plan to fix. They closed flutter/flutter#189770 on 2026-10-02 as intended behaviour. They now discourage the guarded pattern, removed it from their docs, and say it will fail to build once their regex is fixed (closing comment). The guidance there is to follow the direct migration for plugin authors.

The case the guard exists for (an app that keeps android.builtInKotlin=false, Flutter's default) appears to be handled by Flutter itself now. On 3.47.5, FlutterPluginUtils.detectApplyingKotlinGradlePlugin applies kotlin-android to any plugin subproject that doesn't apply it when built-in Kotlin is off (source). So dropping the guard and the apply plugin: 'kotlin-android' line entirely, and keeping the kotlin { compilerOptions { ... } } block, may cover both cases. I haven't checked which minimum Flutter version you support, or whether older versions have that fallback.

Repro

  1. A Flutter 3.47.5 app on AGP 9.x depending on workmanager: ^0.10.10.
  2. Set android.builtInKotlin=true in android/gradle.properties.
  3. flutter build apk --debug. The warning above lists workmanager_android.
主要言語
Dart
スター
1k
フォーク
361
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fluttercommunity/flutter_workmanager のほかの issue

fluttercommunity/flutter_workmanager の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。