Error "Unable to delete file" during clean in Android/Kotlin project
Hi! I'm a beginner in Android development with Kotlin, using Android Studio. When I run the `clean` task in Gradle (via terminal or the IDE button), I constantly get this error:
```
Execution failed for task ':app:clean'.
> Unable to delete file: D:\Projects\MyApp\app\build\intermediates\...\some_file.dex
```
Sometimes the error occurs for different files — sometimes for `.class`, sometimes for `.jar`. I've tried restarting the computer, doing `Invalidate Caches / Restart`, but nothing helps.
Here's my `build.gradle.kts` (simplified):
```kotlin
plugins {
id("com.android.application") version "8.2.0"
id("org.jetbrains.kotlin.android") version "1.9.20"
}
android {
compileSdk = 34
defaultConfig {
applicationId = "com.example.myapp"
minSd
```
No answers yet.
Log in to leave an answer
Blogs