Repository navigation
fix(android): migrate to Built-in Kotlin - #17
Open
ilja-radusch wants to merge 2 commits into
Open
ilja-radusch wants to merge 2 commits into
ilja-radusch wants to merge 2 commits into
Conversation
Flutter 3.50 warns that plugins applying the Kotlin Gradle Plugin will fail to build in a future release (muxable#16). - drop the buildscript block (KGP 1.9.10, AGP 7.3.1 classpath; both supplied by the app), the kotlin-android plugin and the explicit kotlin-stdlib dependency - set the JVM target via the top-level kotlin.compilerOptions block - replace jvmToolchain(17) with Java/Kotlin bytecode target 17, so builds no longer need an exact JDK 17 installed - require Flutter 3.44 / Dart 3.12, from which a migrated plugin builds in apps with android.builtInKotlin=false as well as true Closes muxable#16
Flutter 3.47 deprecated package:flutter/material.dart; CI's flutter analyze on stable (3.50) fails on the example's import, so every PR goes red regardless of its change.
Author
|
The earlier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16.
This follows the Flutter guide for plugin authors: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
Changes
android/build.gradle:buildscriptblock (KGP 1.9.10 and the AGP 7.3.1 classpath; the app supplies both),apply plugin: 'kotlin-android', and the explicitkotlin-stdlibdependency.kotlin { compilerOptions { ... } }block.jvmToolchain(17)with Java/Kotlin bytecode target 17. Same output, but Gradle no longer needs an exact JDK 17 installed; any JDK ≥ 17 builds it.pubspec.yaml: require Flutter 3.44 / Dart 3.12, as the guide asks. From 3.44, a migrated plugin builds in apps withandroid.builtInKotlin=false(Flutter's current default) as well astrue.CHANGELOG.md: entry under "Unreleased". I leftversionalone; since the minimum SDK goes up, 1.3.0 seems right, but that's your call.Testing
We have been running this exact
android/build.gradlein our app (Flutter 3.50, AGP 9.3.1, Gradle 9.5.1,builtInKotlin=false):thermal.ThermalPluginis in the dex.:thermal:compileDebugKotlinand the full app assemble succeed with only a JDK 21 visible to Gradle (org.gradle.java.installations.auto-detect=false).I did not touch the example app. It still uses Gradle 7.0.2 with the imperative
flutter.gradleapply, which current Flutter no longer supports. Updating it is a larger, separate change.