Closed yufengzungzhe closed 9 years ago
Hmm I haven't seen this before. The path in that error message sounds a little odd though...perhaps something is off with the project structure? Can you describe how you're including squidb as a dependency and post the part of your build.gradle that declares it? Are you building from source or from jcenter artifacts?
ok, first please forgive my poor english!
my project is like this: First of all, i create a new project (named MyHelloWorld), and it can work. Then, i execute "File---New---Import Module..." to import "squidb" file to MyHelloWorld project. In the same way, i import "squidb-annotations" and "squidb-processor" files to MyHelloWorld project. Finally, i edit the app module's build.gradle file. For this file ,I just added some content copied from "squidb-sample" module's build.gradle file.
Before edit, the app module's build.gradle file is showing below(all content):
apply plugin: 'com.android.application'
android { compileSdkVersion 22 buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "com.wochacha.myhelloworld"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' }
After edit, the app module's build.gradle file is showing below(all content):
buildscript { repositories { jcenter() }
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
repositories { maven { url "https://dl.bintray.com/yahoo/maven" } }
apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt'
android { compileSdkVersion 22 buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "com.wochacha.myhelloworld"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' compile project(':squidb') compile project(':squidb-annotations') apt project(':squidb-processor')
compile 'javax.inject:javax.inject:1'
compile 'com.squareup.dagger:dagger:1.2.2'
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
}
That's all my project. And you can try to create a new project like this to see if there has the same error.
Well, your project setup looks perfect to me. After a bit more googling, I think you may be running into this issue: https://code.google.com/p/android/issues/detail?id=61300, which appears to be an Android Studio bug of some kind. Can you try some of the suggestions towards the bottom of that thread about finding the process locking the file and killing it?
Thank you very much, it really works now! I killed the process "java.exe", then execute "Rebuild Project" or "Clean Project", there has no error and it can work. May be it's an Android Studio bug. You are so great , thank you!
Awesome, glad to hear it's working now! Good to know that this Studio bug exists. I'm going to close the issue, but we'll keep an eye on things to see if a future version of Studio resolves the issue more permanently.
http://stackoverflow.com/questions/32914499/error-execution-failed-for-task-appclean-unable-to-delete-file After I posted a bug report to the Kotlin bug tracker, I was notified of Issue 61300 on the AOSP tracker. That seems to be the cause. Since there's nothing I can do at the moment, I'll mark this question as answered, and I'll update the answer if the bug is fixed.
In the meantime, if you're running Windows, I believe I've found a workaround. You'll need to download LockHunter (at your own risk of course), then add the following to your module's gradle.build file, replacing the lockhunter variable with your path to LockHunter.exe:
task clean(type: Exec) { ext.lockhunter = '\"C:\LockHunter.exe\"' def buildDir = file(new File("build")) commandLine 'cmd', "$lockhunter", '/delete', '/silent', buildDir } This causes LockHunter to forcefully and silently unlock and delete the build files when the app:clean task runs.
In my simple demo,
how to fix this problem?