20

I keep getting this error and i don't seem to find any help online. I am new to flutter and android studio. any help is well appreciated

  • FAILURE: Build failed with an exception.

    Where: Build file 'C:\Android\Android Studios\cravings\android\app\build.gradle' line: 26

  • What went wrong: A problem occurred evaluating project ':app'.

    Could not open dsl remapped class cache for eq9b73nqpstq0kplnrtticwqc (C:\Users\October Price.gradle\caches\5.6.2\scripts-remapped\flutter_f2f86ofj12jp9hosmvp06kahh\eq9b73nqpstq0kplnrtticwqc\dsl9d9bdfa13168004751655a79e56a065e). Unexpected lock protocol found in lock file. Expected 3, found 0.

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

Dipankar Baghel
  • 1,932
  • 2
  • 12
  • 24
Daniel Separe
  • 303
  • 1
  • 2
  • 7

4 Answers4

20

You can try running the assembleDebug Gradle task manually.

cd android
./gradlew assembleDebug --stacktrace

But there could be something wrong with your configuration. Run flutter doctor -v and see if everything is setup correctly.

Otherwise you can try deleting the Gradle cache folder which seem to bet at C:\Users\October Price.gradle\caches.

kuhnroyal
  • 7,188
  • 1
  • 34
  • 47
  • it appears flutter is not recognized in my windows since i installed it from an android studio. and i haven't accepted a license but i have no idea how to rectify that – Daniel Separe Feb 12 '20 at 16:59
  • i did delete the Gradle cache as you suggested but it didn't change anything – Daniel Separe Feb 12 '20 at 17:00
  • Then try to follow the Windows installation guide, especially the part with the 'Update your path' part: https://flutter.dev/docs/get-started/install/windows - I am not sure Android Studio actually installs flutter. – kuhnroyal Feb 12 '20 at 17:10
  • okay, so i deleted android studio from my computer and did a new installation with flutter as well and have it checked but i am still getting an error – Daniel Separe Feb 13 '20 at 05:48
  • Launching lib\main.dart on Nokia 1 in debug mode... Running Gradle task 'assembleDebug'... FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\October Price\Desktop\cravings\android\app\build.gradle' line: 30 * What went wrong: A problem occurred evaluating project ':app'. > C:\Users\October Price\Desktop\cravings\android\key.properties (The system cannot find the file specified) – Daniel Separe Feb 13 '20 at 05:49
  • * 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 7s Finished with error: Gradle task assembleDebug failed with exit code 1 – Daniel Separe Feb 13 '20 at 05:49
  • Some `key.properties` file is missing, you should first try to run a simple example app. It seems you are trying to run an existing project without everything being setup correctly. – kuhnroyal Feb 13 '20 at 08:19
  • okay so following your advice, i run a simple app which run smoothly but when i copy the files from my old one to the new one, i get same error.... – Daniel Separe Feb 13 '20 at 21:44
  • Launching lib\main.dart on Nokia 1 in debug mode... Running Gradle task 'assembleDebug'... FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\October Price\Desktop\cravings\android\app\build.gradle' line: 30 * What went wrong: A problem occurred evaluating project ':app'. > C:\Users\October Price\Desktop\cravings\android\key.properties (The system cannot find the file specified) – Daniel Separe Feb 13 '20 at 21:45
  • now, there's a key.property file in the old one which i didn't copy. do i have to copy that too? – Daniel Separe Feb 13 '20 at 21:47
  • Probably, since it says that it is missing. This is nothing related to a normal flutter app though. – kuhnroyal Feb 13 '20 at 22:06
  • Launching lib\main.dart on Nokia 1 in debug mode... Running Gradle task 'assembleDebug'... e: C:\Users\October Price\Desktop\cravings\android\app\src\main\kotlin\com\octoberprice\cravings\MainActivity.kt: (10, 48): Type mismatch: inferred type is FlutterEngine but PluginRegistry! was expected FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details – Daniel Separe Feb 13 '20 at 22:34
  • finally got it to run to run. thanks guys. your help was much appreciated. i must say login doesn't work and i am again stacked lol – Daniel Separe Feb 14 '20 at 00:15
  • It may be build for an older flutter version, but that's just guessing. – kuhnroyal Feb 14 '20 at 01:12
12

You can set your android compiler to always run with --stacktrace modifier.

  • Head to Settings > Build, Execution, Deployment > Compiler
  • Add --debug or --info or --stacktrace (Or combination of them) to the Command line options

enter image description here

In your case clearing C:\Users\October Price\.gradle\caches folder and re-syncing the project might help.

Mahdi-Malv
  • 16,677
  • 10
  • 70
  • 117
8

You can also use --verbose to get the full flutter stack trace. so for example:

flutter build apk --debug --verbose

Jendorski Labs
  • 447
  • 2
  • 9
  • 20
2

You can use gradlew command to run from command line. to get more details of gradlew you can type gradlew --help. For further information regarding How to run from Command line follow this link.

Nadeem Shaikh
  • 1,160
  • 9
  • 17