項目編譯的時候經常性的遇到這個問題今天就特地的搜索了一下:
I'm trying to rebuild my Android Studio Gradle project (containing mostly Kotlin code), but it started to throw anUnableToDeleteFileExceptionduring the cleaning/rebuilding process:
Execution failed for task ':app:clean'.
> Unable to delete file: C:\Users\User\KotlinGameEngine\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.1\jars\classes.jar
This started happening after I tried to change my project's package
structure. Unfortunately, I did it by renaming and moving the source
folders rather than refactoring through Android Studio, which was a bad
idea.
答案如下:
1.Doing a Gradle sync;
2.Reinstalling Java JRE and Java SDK;
3.Reinstalling the latest version of Android Studio (1.4);
4.Rolling back to the previous AS version (1.3);
5.Invalidating the AS cache and restarting;
6.Deleting the gradle and .gradle directories in the project directory;
7.Deleting the.gradle directory in my user directory;
8.Running gradlew clean? from the AS terminal;
Manually copying the sources over to a new project (weird that it somehow persists across projects...)
我一般都會用678 三種的其中一個今天特此記錄