Exception: [!] Your app is using an unsupported Gradle project
Asked Answered
E

9

8

I am trying to run my existing flutter application and I am getting this exception. How can I solve this issue?

Exception: [!] Your app is using an unsupported Gradle project. To fix this problem, create a new project by running flutter create -t app <app-directory> and then move the dart code, assets and pubspec.yaml to the new project.

Here are my Flutter doctor results:

[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-EE)
    • Flutter version 1.17.1 at /Users/varsik/Documents/flutterConfigurationFiles/flutter
    • Framework revision f7a6a7906b (2 weeks ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/varsik/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2.1, Build version 11B500
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (1 available)
    • Pixel 3 XL • 8B8Y0VETV • android-arm64 • Android 10 (API 29)

• No issues found!
Endocardial answered 28/5, 2020 at 12:0 Comment(5)
try this command inside the project folder: flutter create .Calendar
flutter create is crating new project. Am I wrong?Endocardial
There is '.' at the end, flutter create . repairs the broken project.Calendar
@ChinkySight unfortunately this did not solve the exception. Thanks for sharing this command with me.Endocardial
why don't you delete the Gradle and reinstall it using android studio?Calendar
S
16

Maybe you removed a line from the

project/android/app/build.grade

Try adding this Piece of Code

apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

after the line

apply plugin: 'com.android.application'
Safe answered 5/12, 2020 at 8:35 Comment(1)
Appreciate your time saving answer!! @SafeSubstantiate
P
3

You might have removed certain lines of code from

project/android/app/build.grade

add below below lines of code before

android {
    namespace "com.example.test_app"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion...

lines of code to be added:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Pistole answered 20/8, 2023 at 14:45 Comment(0)
A
1

For everyone landing here after making changes to the gradle for firebase or smth, it might seem stupid but check that the autoformat(if you have it enabled) didn't make funny things like putting spaces between "->" or "+=" turning them into "- >" or "+ ="

Animus answered 23/8, 2021 at 23:47 Comment(0)
G
0

I resolve this issue by syncing project with gradle files.In android studio from menu open File option and click option sync project with gradle files.

Could you check this solution The project is using an unsupported version of Gradle

Godiva answered 28/5, 2020 at 12:8 Comment(2)
Dear Kaan I do not have an option sync project with gradle files. File directory has Synch with File System. Is it the one you suggest?Endocardial
Can you check this option ? File > Options > Build, Execution, Deployment > Compiler > Sync project with Gradle before building, if neededGodiva
M
0

If you have the backup of your project than go to

project/android/app/build.grade copy all the code and paste it to your project app/build.grade file. Clean Project Now Enjoy. Your error will not appear.

Thankyou.

Mordant answered 27/12, 2020 at 20:8 Comment(0)
P
0

it was helpful in my same problem

Delete android and build directories

run in terminal 1.

flutter create .

flutter run

Picked answered 20/8, 2023 at 22:2 Comment(0)
S
0

Anyone facing this issue. Do as it says.

Create a new Project and copy the build.gradle files contents into your old projects gradle file.

That's it. Don't forget to rename the projects package name.

Sulfide answered 30/9, 2023 at 11:41 Comment(0)
C
0

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\Neways\Downloads\bkash_payment\android\app\build.gradle' line: 4

  • What went wrong: Plugin [id: 'dev.flutter.flutter-gradle-plugin', version: '1.0.0'] was not found in any of the following sources:

  • Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
  • Included Builds (None of the included builds contain this plugin)
  • Plugin Repositories (could not resolve plugin artifact 'dev.flutter.flutter-gradle-plugin:dev.flutter.flutter-gradle-plugin.gradle.plugin:1.0.0') Searched in the following repositories: Gradle Central Plugin Repository
  • 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.

BUILD FAILED in 59s Exception: Gradle task assembleDebug failed with exit code 1

Crownwork answered 20/10, 2023 at 12:30 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Fabio
C
0

Try running

Flutter channel beta

then

Flutter upgrade

and it should work!

Cory answered 22/10, 2023 at 0:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.