Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:Execution failed for task ':app:processDebugResources'. > java.io.IOException: Could not delete folder "" in android studio

I am trying to develop a Android application using Android Studio, so I created an Android app and I want to publish it. Whenever I click on “build project“ to obtain the apk file, I get this error:

Error:Execution failed for task ':app:processDebugResources'.
> java.io.IOException: Could not delete folder C:\Users\ehsan\AndroidStudioProjects\MyApplication3\app\build\generated\source\r\debug\com\example\ehsan

Screenshot showing the error message

Build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.ehsan.myapplication"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
}
like image 621
Ehsan Akbar Avatar asked Feb 27 '16 18:02

Ehsan Akbar


5 Answers

REACT NATIVE

From your react native folder run:

cd android && gradlew clean

THEN

cd .. && react-native run-android

Notes:

For mac you may need to change gradlew to ./gradlew

For the command prompt you may need to change the && to &

For powershell you may need to change the && to ; and gradlew to .\gradlew.bat

Each command can also be run individually like so cd android then gradlew clean then cd .. then react-native run-android

like image 184
Rob Avatar answered Nov 11 '22 05:11

Rob


I guess some of the files in the target build directory is open in another tool you use. Just a file handle open in the folder which has to be cleaned. The build task 'clean' wants to delete all the files in the build directory(normally 'target') and when it fails, the build fails.

like image 36
Henning Luther Avatar answered Nov 11 '22 06:11

Henning Luther


Just clean your project, it works for me.

Clean task for gradle will work.

like image 21
W00di Avatar answered Nov 11 '22 06:11

W00di


Fix This issue by this command

In Windows Platform

cd android && gradlew clean && cd..

In Mac Platform

cd android && ./gradlew clean && cd ..

like image 9
Akash Kumar Avatar answered Nov 11 '22 04:11

Akash Kumar


Fix is very simple: Just follow below instructions

  1. First, save the project
  2. Click on project folder
  3. Click on Syncronize button in the menubar (The third icon from the left which is just below to File menu option)
  4. Clean project and run
like image 5
Shivaramakrishna Agapu Avatar answered Nov 11 '22 04:11

Shivaramakrishna Agapu