错误:任务“:app:processDebugResources"的执行失败.>java.io.IOException: 无法删除文件夹“";在安卓工作室

问题描述:

我正在尝试使用 Android Studio 开发一个 Android 应用程序,所以我创建了一个 Android 应用程序,我想发布它.每当我点击build project"获取apk文件时,我收到此错误:

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

Build.gradle:

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'
}

我猜目标构建目录中的某些文件是在您使用的另一个工具中打开的.只需在必须清理的文件夹中打开一个文件句柄.构建任务'clean'想要删除构建目录(通常是'target')中的所有文件,当它失败时,构建失败.

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.