Error:Execution failed for task ':app:clean'.> Unable to delete file 后面的文件地址,可能是apk,可能是arr,也可能是classes.jar
在使用Android Studio开发时,部分朋友会遇到这个问题,但是又不是每个人都会遇到。而我则是经常遇到,经过长期开机关机的方式来删除build后,终于决定解决这个问题。还是不负有心人啊,终于找到解决方案,在此分享给大家。其实解决不难,只要2步即可。
1、下载工具LockHunter.exe,下载地址:http://pan.baidu.com/s/1bpFlPL1
2、在Android Studio中的build.gradle中配置:
task clean(type: Exec) {
ext.lockhunter = '\"C:\\Program Files\\LockHunter\\LockHunter.exe\\"'
def buildDir = file(new File("build"))
commandLine 'cmd', "$lockhunter", '/delete', '/silent', buildDir
}
如果这个方法还不行,那么请把瞬时启动关闭。具体位置: