androidfluttergradle

Flutter not respecting gradle version


I can't get Flutter to respect the version of gradle in android/gradle/wrapper/gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

Flutter keeps using Gradle 7.2 instead of 8.10

flutter analyze --suggestions
┌───────────────────────────────────────────────────────────────────┐
│ General Info                                                      │
│ [✓] App Name: app                                                 │
│ [✓] Supported Platforms: android, ios, web, macos, linux, windows │
│ [✓] Is Flutter Package: yes                                       │
│ [✓] Uses Material Design: yes                                     │
│ [✓] Is Plugin: no                                                 │
│ [✗] Java/Gradle/Android Gradle Plugin:                            │
│ Incompatible Java/Gradle versions.                                │
│ Java Version: 21.0.4, Gradle Version: 7.2                         │
│                                                                   │
│ See the link below for more information:                          │
│ https://docs.gradle.org/current/userguide/compatibility.html#java │
│                                                                   │
└───────────────────────────────────────────────────────────────────┘

Am I missing some configuration?


Solution

  • Ok, so what worked in the end was the removal of android folder and regenerating it again. I reverted all git changes so it was identical but this time worked. I don't know where Flutter stores additional data outside of project, but good enough for me. Thanks for the answers. 6 hours of life down the drain