Benjamin
Benjamin

Reputation: 6171

Flutter failed to create parent directory

I formatted my PC and kept flutter sdk location in the same spot. The only difference was the name of the user folder. Before it was called "thesl", but now it's "bscho". Whenever I go to build my flutter application, I get this:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Failed to create parent directory 'C:\Users\thesl' when creating directory 'C:\Users\thesl\OneDrive\dev\redlino\redlino\android\app\build\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 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

The path of my Flutter SDK is: C:\dev\flutter

The path of my Flutter app (where the pubspec.yaml is located) is: C:\dev\redlino\redlino (yes the two redlino's are there on purpose)

It also doesn't help that my project files used to be in OneDrive which I have since uninstalled.

Upvotes: 1

Views: 8342

Answers (4)

Mitchell Hein
Mitchell Hein

Reputation: 107

I had switched to a new laptop to work on a project, and got this error when I tried to run. It was looking for a path to the old users folder on the other machine where it was last built. I use OneDrive so all the same folders existed when I went to launch the project on the new machine.

My build folder was in the main project directory /, and after deleting the build folder it launched successfully.

Upvotes: 0

Muhammad Javed
Muhammad Javed

Reputation: 119

I'm also facing the same issue and resolve it by deleting the build folder in the android/app directory. I'm talking about build folder not build.gradle file. So be careful while deleting.

Upvotes: 0

Hridoy Chowdhury
Hridoy Chowdhury

Reputation: 148

In android/app there is build.gradle. Try delete it.

Upvotes: 2

Benjamin
Benjamin

Reputation: 6171

I fixed my problem by deleting the build folder in the android/app directory.

Upvotes: 9

Related Questions