Flutter default counter app fails to run on Android emulator (Gradle task assembleDebug failed)

Hello everyone, I am new to Flutter and wanted to start by running the default counter app created via Flutter: New Project → Application

When I try to run this app on an emulated Android device (Google Pixel 9), the build always fails with the following error:

Gradle task assembleDebug failed with exit code 1

I have installed Flutter, Android Studio, and the Android Emulator exactly as described in the official documentation.
My operating system is Windows 11.

Things I have already tried:

  • Disabled real-time protection in Windows Defender
  • Verified the setup with flutter doctor (no issues reported)
  • Running the app in Chrome works without any problems

The issue only occurs when running the app on the Android emulator.

Here is the full error message:

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\dev\Flutter Projekte\my_first_app\android\settings.gradle.kts' line: 20

* What went wrong:
Error resolving plugin [id: 'dev.flutter.flutter-plugin-loader', version: '1.0.0']
> A problem occurred configuring project ':gradle'.
   > Multiple build operations failed.
         Could not move temporary workspace (C:\Users\marvi\.gradle\caches\8.14\transforms\8b7a8db04f880977c033a49d68f5c7b3-f7b78e79-b6df-487a-ac1a-0001f2d3b289) to immutable location (C:\Users\marvi\.gradle\caches\8.14\transforms\8b7a8db04f880977c033a49d68f5c7b3)
         Could not move temporary workspace (C:\Users\marvi\.gradle\caches\8.14\transforms\0b6f6b7d0f2a1f4c9c7c5ec70c8cf723-0be7af6f-54ae-4263-98af-ae8e20763fa4) to immutable location (C:\Users\marvi\.gradle\caches\8.14\transforms\0b6f6b7d0f2a1f4c9c7c5ec70c8cf723)
      > Could not move temporary workspace (C:\Users\marvi\.gradle\caches\8.14\transforms\8b7a8db04f880977c033a49d68f5c7b3-f7b78e79-b6df-487a-ac1a-0001f2d3b289) to immutable location (C:\Users\marvi\.gradle\caches\8.14\transforms\8b7a8db04f880977c033a49d68f5c7b3)
      > Could not move temporary workspace (C:\Users\marvi\.gradle\caches\8.14\transforms\0b6f6b7d0f2a1f4c9c7c5ec70c8cf723-0be7af6f-54ae-4263-98af-ae8e20763fa4) to immutable location (C:\Users\marvi\.gradle\caches\8.14\transforms\0b6f6b7d0f2a1f4c9c7c5ec70c8cf723)

* 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 28s
Error: Gradle task assembleDebug failed with exit code 1

Has anyone encountered this issue before or knows how to fix it?

Lot of people mention bitdefender. I had so many non flutter issues with bitdefender in my job. Worst av ever, I have no idea why do so many people use it.

You could delete that gradle folder too. Or use gradle 9, maybe they fixed this. I’ve been using gradle 9 for a while now, no issues. If I remember correctly, it needs a few changes in your configs to be able to use it.

1 Like

Thank you very much for the hint. I realized that McAfee was preinstalled on my notebook. After uninstalling McAfee, everything seems to be working properly. :slight_smile:

1 Like

Forgot about mcafee, might worse than bitdefender :rofl: