Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter run release fails: Minimum supported Gradle version is 5.6.4. Current version is 5.6.2

When trying to run my app with flutter run --release it throws an error:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Chris\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info-0.4.2+1\android\build.gradle' line: 22

* What went wrong:
A problem occurred evaluating root project 'device_info'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 5.6.4. Current version is 5.6.2. If using the gradle wrapper, try editing the distributionUrl in C:\Users\Chris\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info-0.4.2+1\android\gradle\wrapper\gradle-wrapper.properties to gradle-5.6.4-all.zip

If I remove this device_info plugin, I get the same error just pointing to Gradle current version to be 4.10.2 due to another plugin flutter_plugin_android_lifecycle.

I don't understand. I tried updating my gradle-wrapper.properties to

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

Previously it was set to 5.6.2, but this changed nothing. Also tried with 4.10.2, but it equally just get's ignored. I updated the gradle version in my build.gradle to

buildscript {
    ext.kotlin_version = '1.3.61'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

I created a new flutter project, just copied my pages and the pubspec... I tried in console, I tried with android studio. flutter clean, flutter build appBundle, deleting gradle versions, I tried everything I could think of or that I have read somewhere... Nothing could help to get rid of this error, gradle insists that its current version is 5.6.2. A new "virgin" flutter project however, I can run in release mode, without problems.

It appears these plugins will download their own gradle version. I could see it in Android Studio how an old gradle version is downloaded in contrary to the actual gradle version stated in my settings. Either way after 3 days with this, I'm running out of options and ideas.

Does anyone know how to solve this or to narrow the problem down? I also would be glad for an explanation on what's going on here.

My flutter doctor output:

[√] Flutter (Channel master, v1.17.1-pre.23, on Microsoft Windows [Version 10.0.18362.720], locale de-DE)
    • Flutter version 1.17.1-pre.23 at C:\flutter
    • Framework revision a2e6c30b44 (12 hours ago), 2020-04-03 20:26:01 -0700
    • Engine revision 09bc1fc45e
    • Dart version 2.8.0 (build 2.8.0-dev.19.0 e736495eb7)


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\Chris\AppData\Local\Android\sdk
    • Platform android-R, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 45.0.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.43.2)
    • VS Code at C:\Users\Chris\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.9.0

[√] Connected device (1 available)
    • Lenovo A6020l36 • 32aac289 • android-arm64 • Android 5.1.1 (API 22)

• No issues found!
like image 947
Chris Avatar asked Apr 04 '20 15:04

Chris


1 Answers

I found the problem. It was a totally different plugin unique_identifier 0.0.3 that caused the error. After removing it, the app compiles dine again.

If you have a similar case: I had to test for every single package installed until I found it.

like image 127
Chris Avatar answered Oct 07 '22 15:10

Chris