'[Flutter Error]-Execution failed for task ':app:compileFlutterBuildDebug'

I recently formatted my pc and upgraded to windows 11.When I try to run my flutter app on my mobile phone,I get this error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Failed to create parent directory 'C:\Users\HP' when creating directory
'C:\Users\HP\Desktop\OWASLO\care_receiver_app\ss_carereceiver_app\android\app\build\intermed iates\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 56s
 Exception: Gradle task assembleDebug failed with exit code 1

the path mentioned in the error log

C:\Users\HP\Desktop\OWASLO\care_receiver_app\ss_carereceiver_app\android\app\build\intermed iates\flutter\debug\flutter_assets

is where my app was before I formatted and

"C:\Users\HP"

was the user name before the laptop was formatted. The app works fine on chrome but wont work on mobile. Please help!!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source