Home > Enterprise >  after upgrade flutter to version 3, my exist project is not building
after upgrade flutter to version 3, my exist project is not building

Time:05-13

i was working on project using flutter 2.10.0 version, it work fine, but after upgrade flutter to 3.0.0 version, my project is not building, it give me this error

[        ] > Task :app:compileFlutterBuildDebug FAILED
[        ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[        ] Use '--warning-mode all' to show the individual deprecation warnings.
[        ] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[        ] 1 actionable task: 1 executed
[        ] FAILURE: Build failed with an exception.
[        ] * Where:
[        ] Script '/home/user/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156
[        ] * What went wrong:
[        ] Execution failed for task ':app:compileFlutterBuildDebug'.
[        ] > Process 'command '/home/user/snap/flutter/common/flutter/bin/flutter'' finished with non-zero exit value 1
[        ] * 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 18s
[  550 ms] Exception: Gradle task assembleDebug failed with exit code 1

CodePudding user response:

This Blog Might help you Out

If you create a new project with the Flutter tool, you might notice that the generated files now use the latest versions of the Gradle and Android Gradle plugins. For existing projects, you need to manually bump the versions to 7.4 for Gradle, and 7.1.2 for the Android Gradle plugin.

https://medium.com/flutter/whats-new-in-flutter-3-8c74a5bc32d0

CodePudding user response:

I fixed it updating 'build.gradle' from:

classpath("com.android.tools.build:gradle:3.5.3")

to

classpath("com.android.tools.build:gradle:3.5.4")

See more info in:

https://developer.android.com/studio/releases/gradle-plugin#4-0-0

If the above does not fix the error try this:

After changing the following line: distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip in

android/gradle/wrapper/gradle-wrapper.properties

Only need to change the version number.

Ran the following command: cd android && ./gradlew clean

  • Related