1
votes

Can anyone tell me what's wrong with Android Studio. I cannot run flutter projects. It returns the error showed in the picture.

Android Studio version: 3.6.3 Flutter version: 1.22.1 with Dart 2.10.1

The Error showed while executing main.dart:

Launching lib\main.dart on Android SDK built for x86 in debug mode... Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

  • Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 41

  • What went wrong: A problem occurred evaluating script.

FlutterPlugin

  • 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 23s Exception: Gradle task assembleDebug failed with exit code 1

Error message from main.dart

2

2 Answers

0
votes

I have faced this error before and the solution that works for me is to clean the build folder by using

flutter clean

and uninstall the app from emulator/connect to any other device

0
votes

Found the solution: I had to delete the cache file from .gradle folder and run project. And it worked.

Directory of the cache file: C:\user(username)\ .gradle