I try to change minSdkVersion
in build.gradle
(Module: app) in Android Studio
and get next error:
Error:Timeout waitin
For A novice like me, who encountered the situation for the first time and was not able to delete the .lock file or the .gradle folder,
In windows 10 or others, restart the pc using safe mode,(windows key + R ---> msconfig ----> select boot, boot in safe mode----> restart) then delete the files, (this should delete the files and folder)
then in normal mode, restart android studio and sync gradle to download the appropriate version (hopefully the project should work now)
Your build.gradle file likely contains multiple statements of
minSdkVersion
. Possibly in defaultConfig{}
block and productFlavors{}
block. Make sure you are only declaring minSdkVersion once in the build file.
What worked for me:
projectPath=[yourProjectPath]
find $projectPath/.gradle -name '*.lock' -delete
You can also remove them one by one:
gradleVersion=[yourProjectGradleVersion]
projectPath=[yourProjectPath]
rm -f $projectPath/.gradle/$gradleVersion/taskHistory/taskHistory.lock $projectPath/.gradle/$gradleVersion/fileHashes/fileHashes.lock $projectPath/.gradle/$gradleVersion/fileContent/fileContent.lock $projectPath/.gradle/$gradleVersion/javaCompile/javaCompile.lock $projectPath/.gradle/buildOutputCleanup/buildOutputCleanup.lock
"Lock file: C:\Users\Administrator\.gradle\caches\2.2.1\scripts\build_f00bwdji3qxl7urq5chsbakgv\ProjectScript\buildscript\cache.properties.lock"
You should delete the file in this extension. Then you will see that the problem is fixed. I lived the same problem.
Sometimes it was notable to delete filehash.lock file and it will throw an error unable to delete file. So do the following steps
For Windows machine:
Open Task Manager(Ctrl-Alt-Delete and check Process)
-> If you run two instance of android studio, Close One (End Task)
-> Then close OpenJDK Platform Binary
-> Gradle sync now on AndroidStudio and it will work now
This worked for me.
ps -ef | grep gradle
rm C:\Users\Administrator\.gradle\caches\2.2.1\scripts\build_f00bwdji3qxl7urq5chsbakgv\ProjectScript\buildscript\cache.properties.lock
Thanks,