I am facing “Failed create parent directory” in my flutter projects. I ran flutter clean followed by flutter run, and the app was up and running.
However, the problem is that it only works from the terminal. If I try to run the app using the VS Code GUI (the button in the top right), the same error reappears. Even after running flutter clean and then clicking the debug button, the error still persists.
Launching lib\main.dart on SM N975F in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
\> Failed to create parent directory 'C:\Users\Mujeeb' when creating directory 'C:\Users\Mujeeb\ Khawaja\Desktop\flutter\ projects\new\ videx\videx\build\app\intermediates\flutter\debug\flutter_assets'
* 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 6s
Error: Gradle task assembleDebug failed with exit code 1
My directory name in “This PC” is C:\Users\Mujeeb Khawaja, not C:\Users\Mujeeb and flutter is trying to do C:\Users\Mujeeb\ Khawaja\
Well, obviously something is not good in handling spaces in paths.
Use --stacktrace or --scan to find out who and report it as bug.
As a workaround, move the project to a path without spaces.
Android Studio Meerkat Feature Drop | 2024.3.2 Patch 1
Build #AI-243.26053.27.2432.13536105, built on May 22, 2025
Meerkat might have updated tooling that resolves the path-handling issues introduced in newer Flutter versions.
2. Reinstall the Android SDK via Android Studio
Go to Preferences > SDK Manager
Remove the old SDK (optional but recommended)
Re-download the latest stable Android SDK using Meerkat
Result
After doing the above:
No more need to delete the build/ folder
App runs both via terminal and VS Code GUI
Smooth build and debug experience
No Gradle-related parent directory errors
Takeaway
I was using Android Studio Koala which I think has poor integration with latest Flutter versions or any version, especially in Windows environments with spaced usernames or project paths. Upgrading to Android Studio Meerkat and reinstalling the SDK completely solves the issue.