几个月前更新Android Studio2.1后调试运行程序出现unable to delete directory错误,具体是无法删除build→ouput下的apk文件夹,手动删除也不行,在网上搜了很久,有人说在网上下一个LockHunter.exe,再在build.gradle(Module:app)在最外层(也就是和dependencies同级)添加如下代码:
task clean(type: Exec) { ext.lockhunter = '\"C:\\LockHunter\\LockHunter.exe\"' def buildDir = file(new File("build")) commandLine 'cmd', "$lockhunter", '/delete', '/silent', buildDir }
亲测可用哈