Android studio 编译错误:Execution failed for task ':app:clean'

1、问题描述:

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

2、解决方案:

在build.gradle文件添加如下内容;
作用就是在app:clean 的时候解锁并且强制删除编译的产生的文件;

task clean(type: Exec) {
    ext.lockhunter = '\"C:\\LockHunter.exe\"'
    def buildDir = file(new File("build"))
    commandLine 'cmd', "$lockhunter", '/delete', '/silent', buildDir
}

你可能感兴趣的:(android)