Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio can't delete files when compiling

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'.
> com.android.build.api.transform.TransformException: java.io.IOException: 
Could not delete path 'D:\ProgrammazioneOffline\ProjectFolder\app\build\intermediates\transform
 s\desugar\debug\1.jar'.

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

like image 676
Edoardo396 Avatar asked Oct 24 '17 18:10

Edoardo396


People also ask

Why I can't delete my files Android?

Sometimes, the Media Storage app is the reason you cannot delete file from internal storage Android. To fix this, you need to clear the app's cache and data. Head into Settings > Apps & notifications, tap the three dots at the top, and select Show system. Select Media Storage and then tap Storage & cache.

How do I force delete a file from running?

Use Shift + Delete to Force Delete File/Folder. You can select the target file or folder and press Shift + Delete keyboard shortcut to delete the file/folder permanently. This file deletion method won't pass the Recycle Bin.

How do I delete items in Android Studio?

How do I delete a project in Android Studio? In the Android Studio welcome screen, click on the project name and select Remove From List. Select File > Open Recent > Manage Projects, select the project, and press the delete key or click the X that's displayed on it.


1 Answers

Faced this many times,just rebuild your project and check the error message that android studio is displaying and remember the file name that android studio is asking to delete,after then go manually to that file like :C/users/youruser/androidstudioprojects/.../ find that file and delete it manually after then go back to android studio and clean the project this time you won't get error....

Hope This Help..

like image 124
Khalid Aziz Avatar answered Oct 20 '22 03:10

Khalid Aziz