Skip to content

New project with 'image_picker' and 'flutter_native_web' plugins give error ''Minimum supported Gradle version is 5.4.1. Current version is 4.10.2." when running flutter build apk #48724

@Dancovich

Description

@Dancovich

When creating a new flutter project with flutter create (Flutter 1.12.13+hotfix.5 on channel stable), editing pubspec.yaml to add dependencies to flutter_native_web: ^1.0.3 and image_picker: ^0.6.3 (and running flutter pub get to update the dependencies) and running flutter build apk the build fails with the following error:

FAILURE: Build failed with an exception.

* Where:
Build file '/home/81986912515/Desenvolvimento/Ferramentas/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.3/android/build.gradle' line: 22

* What went wrong:
A problem occurred evaluating root project 'flutter_plugin_android_lifecycle'.
> Failed to apply plugin [id 'com.android.library']
   > Minimum supported Gradle version is 5.4.1. Current version is 4.10.2. If using the gradle wrapper, try editing the distributionUrl in /home/81986912515/Desenvolvimento/Ferramentas/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.3/android/gradle/wrapper/gradle-wrapper.properties to gradle-5.4.1-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s


The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.

This issue is based on #42082 and gives an example of this bug still happening in a specific project configuration.

STEPS TO REPRODUCE

  • Create a new project with flutter create a_new_project
  • Edit pubspec.yaml to add dependencies to flutter_native_web: ^1.0.3 and image_picker: ^0.6.3
  • Run flutter pub get
  • Run flutter build apk
  • Build will fail
  • Remove any of the two dependencies above and run flutter pub get again
  • Build now succeeds

Here's a sample project with the issue happening: https://github.com/Dancovich/gradle_error_sample

Here's the result of flutter doctor

flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Linux, locale pt_BR.UTF-8)
    • Flutter version 1.12.13+hotfix.5 at /home/81986912515/Desenvolvimento/Ferramentas/flutter
    • Framework revision 27321ebbad (5 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/81986912515/Desenvolvimento/Ferramentas/android-sdk-linux
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /home/81986912515/Desenvolvimento/Ferramentas/android-sdk-linux
    • Java binary at: /home/81986912515/Desenvolvimento/Ferramentas/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Android Studio (version 3.2)
    • Android Studio at /home/81986912515/Desenvolvimento/Ferramentas/android-studio-3.2.1/android-studio
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] Android Studio (version 3.5)
    • Android Studio at /home/81986912515/Desenvolvimento/Ferramentas/android-studio
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
    • IntelliJ at /home/81986912515/Desenvolvimento/Ferramentas/intellij-idea
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] Connected device (1 available)
    • SM G950F • ce11182b72a0ba3a02 • android-arm64 • Android 9 (API 28)

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: buildBuilding flutter applications with the toolcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.packageflutter/packages repository. See also p: labels.platform-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