Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to delete directory in Android Studio

Today I updated my Android Studio to 2.0 and when I run my project is gives me this error

Error:Execution failed for task ':app:clean'.
> Unable to delete directory: /media/dev1/08782A6D782A5A281/workspace/gengold/GenGold/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/jars

This is my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
    defaultConfig {
        applicationId "com.mobile.gengold"
        minSdkVersion 15
        targetSdkVersion 21
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {

    compile 'com.android.support:support-v4:21.0.2'
    compile 'com.android.support:appcompat-v7:21.0.3'
        /*compile 'com.google.android.gms:play-services-maps:6.5.+'*/
    compile 'com.google.android.gms:play-services:6.5.87'
    compile files('libs/jncryptor-1.2.0.jar')
}

I have deleted the jars from that directory but it shows the error repeatedly. Also it creates the directory again.

like image 468
Akshat Vajpayee Avatar asked Apr 08 '16 06:04

Akshat Vajpayee


People also ask

How do I delete directory?

To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r . Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents removed with the rm -r command.


2 Answers

I have exactly the same problem. The only temporary solution I've found is to exit Android Studio, delete the entire "build" folder (not only the jars), and then getting back to Android Studio to Build it.

The first build goes without errors or any warnings, but to rebuild again you need to follow the same steps as before :(

This is not a solution, obviously, but seems like the problem comes out from any service keeping occupied the files to be deleted in the "Clean" part of the rebuilding process.

EDIT:

It seems there is a problem with NTFS file system in android 2.0 Check out in https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=&id=206219

like image 111
Salvador Moreno Avatar answered Oct 02 '22 17:10

Salvador Moreno


I'm using Android Studio 2.3.3 on windows, had the same problem, tried deleting the folder and got Access denied, rebooting my computer did not help either, for me the solution was : In Android Studio > File > Invalidate Caches / Restart...

like image 38
hmk Avatar answered Oct 02 '22 16:10

hmk