1. 程式人生 > >Gradle 構建的時候出現瞭如下錯誤: java.io.IOException: Could not delet folder "xxx"

Gradle 構建的時候出現瞭如下錯誤: java.io.IOException: Could not delet folder "xxx"

AndroidStudio Gradle 構建的時候出現瞭如下錯誤

Error:Execution failed for task ‘:app:processDebugResources’.
java.io.IOException: Could not delete folder C:\Users\xxx\AndroidStudioProjects\MyApplication\app\build\xxx

如何解決:
1 . 你可以嘗試刪除檔案路徑下的資料夾


2 . 如果你的專案構建採用的JDK是java8,你應該在module下的build.gradle

中新增如下程式碼

 android {  
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}
  1. File 目錄下 點選 Invalidate Cache & Restart
To all the viewers visiting this page, as per my recent experience, 'Invalidate Cache & Restart' solves the problem. No need to
disable/enable instant run and deleting folders manually. (Android Studio 3.0.1)