Error:Timeout waiting to lock buildscript class cache for build file when change minSdkVersion

后端 未结 15 1704
不知归路
不知归路 2020-12-05 08:55

I try to change minSdkVersion in build.gradle (Module: app) in Android Studio and get next error:

Error:Timeout waitin         


        
相关标签:
15条回答
  • 2020-12-05 09:43

    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)

    0 讨论(0)
  • 2020-12-05 09:45

    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.

    0 讨论(0)
  • 2020-12-05 09:46

    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 
    
    0 讨论(0)
  • 2020-12-05 09:47
    "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.

    0 讨论(0)
  • 2020-12-05 09:49

    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

    0 讨论(0)
  • 2020-12-05 09:54

    This worked for me.

    kill all instances of the gradle process.

    ps -ef | grep gradle

    delete the 'Lock file'

    rm C:\Users\Administrator\.gradle\caches\2.2.1\scripts\build_f00bwdji3qxl7urq5chsbakgv\ProjectScript\buildscript\cache.properties.lock

    Thanks,

    0 讨论(0)
提交回复
热议问题