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

Viewed 4641

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!
4 Answers

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'

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.

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 "+ ="

Related