error:execution failed for task ‘:app:clean’. > unable to delete file: \app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1[jars](http://en.wikipedia.org/wiki/Jar “Jar”)\classes.jar

Hello guys and coders as Android studio got 2.0 Preview released,and with this new release their is problem while Cleaning or Rebuilding Project. So when you clean your project you got an awesome error says (“error:execution failed for task ‘:app:clean’. > unable to delete file: \app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\jars\classes.jar”), or something like this which ends with “Unable to delete jars\classes.jar”) file.

Execution failed for task ':app:clean' unable to delete jars\classes.jar

So if you goto that directory manually and delete that classes.jar file then you get same error “Unable to delete jars\classes.jar”.

So there are two methods to resolve this problem as of now :

Method 1 :

  • Just read the path where you got that error.

in my Android studio i got

error:execution failed for task ‘:app:clean’. > unable to delete file: \app\build\intermediates\exploded-aar\com.android.support**appcompat-v7\23.1.1\jars\classes.jar**

Execution failed for task ':app:clean' unable to delete jars\classes.jar

  • as you can see i got this error due to appcompat-v7, So i will simply remove appcompat library from my project and Sync my project.

Execution failed for task ':app:clean' unable to delete jars\classes.jar

Execution failed for task ':app:clean' unable to delete jars\classes.jar

(to remove library simply remove Gradle dependency from build.gradle file inside you app. )

  • After Sync Gradle you can see that error was gone and my project build successfully.

Execution failed for task ':app:clean' unable to delete jars\classes.jar

  • Now add Gradle dependency of that library to your project and Sync Gradle again.

Execution failed for task ':app:clean' unable to delete jars\classes.jar

Viola !!! Your project build successfully and their is no more error.

Note : if in your case problem arise with any custom jar file which you have loaded into your app, then simply delete that jar file Sync Gradle, after successful build add your jar file again into your project.)

Method 2:

This method is not recommended because this method take long time.

  • In this method simply Restart Android Studio (close and start again).

And error was gone.

So i prefer 1st method.