java – Android Studio can't delete files when compiling-ThrowExceptions

Exception or error:

When I compile my app in order to run it on the emulator, Android Studio (version 3.0 RC2) complains because it can’t delete the 1.jar file inside my project folder.

Here is the error message:

Error:Execution failed for task ':app:transformClassesWithDesugarForDebug'.
Could not delete path 'D:\ProgrammazioneOffline\ProjectFolder\app\build\intermediates\transform

I found that cleaning the project makes it compile again but after a while it complains again.
My project is not that small and rebuilding all every time takes a lot of time (around 4 mins when rebuilding all compared to 30 second when it works fine).

I had formatted my PC and changed the project’s path before the problem appeared. Did I forget to chenge some references to the project somewhere?

I did not find this issue in the knows issues.

Thanks in advance and sorry for my bad English.

EDIT: I found out that the file is being used by java.exe and killing it via cmd makes the compilation run but shouldn’t it be done by Android Studio?

EDIT2: It was the firebase plugin, the issue has been fixed, see my accepted answer

How to solve:

Maybe your jar is still running when you try to re compile?

If so your system cannot delete is since it’s being used


Try to use external jdk instead of the embedded one.


Another chance is temporarily disable desugaring and bring back retrolambda until the bug will be fixed.


The google team realized that one of the causes is the firebase performance plugin. Remove it if you have it.


It seems that now the issue has been fixed. Update your firebase-perf plugin to version 1.1.4+ (‘’) and your firebase dependencies to version 11.6.0+.

Thanks to anyone who answered the question.



just open the project location. find your file which is not deleting. if you try to delete that single file it won’t .so just copy all other files which should not be deleted and delete the whole file which you wanted to be deleted
eg:drawable: Ob_photo
//(i must delete this file)as file name should not be a capital letter


delete whole drawable file copying ic_photo2

Leave a Reply

Your email address will not be published. Required fields are marked *