1. 程式人生 > >Error:Execution failed for task ':app:clean'. > Unable to delete directory: 最新解決方法

Error:Execution failed for task ':app:clean'. > Unable to delete directory: 最新解決方法

最近在一個新的專案BUILD過程中遇到了這個問題

Error:Execution failed for task ‘:app:clean’.
Unable to delete directory:**

我的studio是2.3.3

之前我也遇到過類似問題 之前的解決方法是在app:build檔案中加入了

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

但是這次加上去之後好像並沒有什麼用 又出現了一個新的問題

Error:(23, 0) Declaring custom ‘clean’ task when using the standard Gradle lifecycle plugins is not >allowed.
Open File

最後查詢各種資料 然後發現overflow上有一個文章貼出瞭解決辦法,把上面程式碼換成下面的:

clean {
delete rootProject.buildDir
}