Skip to content

[Android] Kotlin support library dependency no longer required #98212

@davidmigloz

Description

@davidmigloz

At the moment, all Flutter Android Kotlin templates contain a dependency on the Kotlin support library. E.g.:

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

Starting from Kotlin 1.4, the Kotlin Gradle plugin adds the dependency on the standard library automatically by default: (ref)

You no longer need to declare a dependency on the stdlib library in any Kotlin Gradle project, including a multiplatform one. The dependency is added by default.

The automatically added standard library will be the same version of the Kotlin Gradle plugin, since they have the same versioning.

For platform-specific source sets, the corresponding platform-specific variant of the library is used, while a common standard library is added to the rest. The Kotlin Gradle plugin will select the appropriate JVM standard library depending on the kotlinOptions.jvmTarget compiler option of your Gradle build script.

The current Kotlin version in the templates is 1.6.10:

const String templateKotlinGradlePluginVersion = '1.6.10';

So the explicit dependency to the Kotlin support library dependency is no longer required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterplatform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on AndroidtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions