Clean project error with databinding: Unable to delete file androidx.databinding.library.baseAdapters--setter_store.json

I close Android Studio, delete the app\build folder then reopen Android Studio. Note that all instances of AS must be closed for Windows to let you delete the build folder.


Put Below command in Android Studio terminal.

gradlew --stop


So, the problem is still here but all answers don't solve it. Project doesn't compile for a reason, usually it's some kind of mistake, and if you just delete build folder (which contains file Android Studio is unable to delete) it will not solve problem.

When you are trying to compile project you may get a dozens of errors in generated files (databinding, room, etc). Unfortunatelly, errors are not displaying in the usual window, but if you expand this generated files with errors, you probably will see the real problem, your mistakes you didn't fix when was changing your classes related to generated files. Just fix these mistakes and compile project again. Note: you probably should to look at warnings too.

But if you already got error Unable to delete file you won't see errors in generated files. You need to restart Android studio (if it won't help, you need to delete app\build) and try to compile your project. After that you will find generated files with errors in build tab.

Hope it helps!