Execution failed for app:clean in android studio 2.2

2.7k Views Asked by At

I currently switch to android studio 2.2 and I have a big problem. when I build project to deploy on emulator I got this error:

Error:Execution failed for task ':app:clean'.
> Unable to delete directory: /mnt/D/Document/WorkSpace/Android/Test/app/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/25.0.0/jars

I clean that path and again it tell me that:

Error:Execution failed for task ':app:clean'.
> Unable to delete directory: /mnt/D/Document/WorkSpace/Android/Test/app/build/intermediates/exploded-aar/com.android.support/cardview-v7/25.0.0/jars

I clean it handy and again:

Error:Execution failed for task ':app:clean'.
> Unable to delete directory: /mnt/D/Document/WorkSpace/Android/Test/app/build/intermediates/exploded-aar/com.android.support/support-compat/25.0.0/jars/libs

I don't know how many steps exists and if I pass all these steps, may be I mentally! I don't have these issues in android 1.4. is this a bug about android studio or related to my system(Arch Linux)? Thanks in advance.

3

There are 3 best solutions below

3
linarcx On BEST ANSWER

i finally fix it! after:

apply plugin: 'com.android.application'

add this line of code to build.gradle(Module: app) file:

task clean(type: Delete) {
    delete rootProject.buildDir
}

it will delete all jar and lib files from build your directory. hope to enjoy :)

2
Ashwini On

Disable Instant Run. It is in File -> Settings -> Build,Execution -> Instant Run

This worked for me.

0
milosmns On

For me there was a stuck debug test inside of Android Studio and mockable-jar was used inside of that JVM and couldn't be deleted.

What I had to do is.. stop the frozen JVM from Task Manager, then clean.

What I'll do the next time this happens is.. stop the frozen debug test from Android Studio, then clean.