Skip to content

[Android] Flutter template project is misconfigured and causing incompatible Kotlin and Gradle versions issue #153885

@drrnbrns

Description

@drrnbrns

Steps to reproduce

First seen in 3.24.1. Wasn't happening in 3.22.3. The generated APK works, but there shouldn't be errors reported in the sample project.

  1. flutter create --platforms=android test
  2. cd test
  3. flutter build apk

Expected results

No errors about mismatched Kotlin versions

Actual results

Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1384 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
e: C:/Users/User/.gradle/caches/transforms-3/c683cde5b1f5377825fe27da54e1b718/transformed/fragment-1.7.1/jars/classes.jar!/META-INF/fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/User/.gradle/caches/transforms-3/4b07bb875192e8c29c9b76677237c5c8/transformed/jetified-activity-1.8.1/jars/classes.jar!/META-INF/activity_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: C:/Users/User/.gradle/caches/transforms-3/455c428e62a6dd75da98c7152f7af462/transformed/jetified-lifecycle-livedata-core-ktx-2.7.0/jars/classes.jar!/META-INF/lifecycle-livedata-core-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.

(etc). Note that removing that C:/Users/User/.gradle/caches folder does not help.

Code sample

Uses sample code generated as descried above

Screenshots or Video

No response

Logs

Logs shown in "Expected results"

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [Version 10.0.19045.4780], locale en-US)
    • Flutter version 3.24.1 on channel stable at C:\Users\User\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5874a72aa4 (24 hours ago), 2024-08-20 16:46:00 -0500
    • Engine revision c9b9d5780d
    • Dart version 3.5.1
    • DevTools version 2.37.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\User\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] VS Code (version 1.92.2)
    • VS Code at C:\Users\User\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.94.0

[√] Connected device (4 available)
    • Nexus 5 (mobile)  • 06b053caf0e9599b • android-arm    • Android 6.0.1 (API 23)
    • Windows (desktop) • windows          • windows-x64    • Microsoft Windows [Version 10.0.19045.4780]
    • Chrome (web)      • chrome           • web-javascript • Google Chrome 127.0.6533.120
    • Edge (web)        • edge             • web-javascript • Microsoft Edge 127.0.2651.105

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

Labels

found in release: 3.24Found to occur in 3.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versiont: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtoolAffects 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