Reputation: 1348
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!
Upvotes: 10
Views: 18665
Reputation: 503
if anyone has this problem, just add the line id "dev.flutter.flutter-gradle-plugin"
to plugin
section in android/app/build.gradle
Upvotes: 1
Reputation: 1
Try running
Flutter channel beta
then
Flutter upgrade
and it should work!
Upvotes: 0
Reputation: 1
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:
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
Upvotes: 0
Reputation: 83
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.
Upvotes: 0
Reputation: 77
it was helpful in my same problem
Delete android and build directories
run in terminal 1.
flutter create .
flutter run
Upvotes: 0
Reputation: 41
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"
Upvotes: 4
Reputation: 41
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 "+ ="
Upvotes: 1
Reputation: 150
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.
Upvotes: 0
Reputation: 1004
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'
Upvotes: 17
Reputation: 1
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
Upvotes: 0