Fixing "Unable to delete directory" Build Errors in Android Studio If you're encountering the frustrating "Unable to delete directory '...\app\build'" error on Windows, you're not alone. This is a common issue where a process, often Android Studio itself or a Gradle daemon, retains a lock on files within the build directory, preventing Gradle from cleaning or rebuilding your project. This guide will walk you through the most effective solutions to resolve this file lock issue and get your builds working again. Understanding the Error The error message typically looks like this: Unable to delete directory 'C:\Users\YourName\YourProject\app\build' Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory. This is almost always a Windows file locking issue . The culprit can be: The Gradle Daemon (a background process) Android Studio's internal processes W...