错误:更改minSdkVersion时,超时等待锁定构建文件的buildscript类高速缓存

时间:2021-12-02 00:28:27

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

我尝试在Android Studio中的build.gradle(Module:app)中更改minSdkVersion并获取下一个错误:

Error:Timeout waiting to lock buildscript class cache for build file 'E:\pathtoproject\app\build.gradle' (C:\Users\Administrator\.gradle\caches\2.2.1\scripts\build_f00bwdji3qxl7urq5chsbakgv\ProjectScript\buildscript). It is currently in use by another Gradle instance.
Owner PID: unknown
Our PID: 4592
Owner Operation: unknown
Our operation: Initialize cache
Lock file: C:\Users\Administrator\.gradle\caches\2.2.1\scripts\build_f00bwdji3qxl7urq5chsbakgv\ProjectScript\buildscript\cache.properties.lock

What is it error? How to change minSdkVersion ?

这是什么错误?如何改变minSdkVersion?

6 个解决方案

#1


74  

This sounds like it's related to https://issues.gradle.org/browse/GRADLE-2795.

这听起来像是与https://issues.gradle.org/browse/GRADLE-2795有关。

The easiest way to solve this will be to delete everything under C:\Users\Administrator\.gradle\caches. There is a cache.properties.lock that is holding a global lock which is preventing you from running your script.

解决此问题的最简单方法是删除C:\ Users \ Administrator \ .gradle \ caches下的所有内容。有一个cache.properties.lock,它持有一个全局锁,阻止你运行你的脚本。

For Mac OSX the folder is located in ~/.gradle/caches. The Android Studio should show the proper path to the file which is causing the lock anyway.

对于Mac OSX,该文件夹位于〜/ .gradle / caches中。 Android Studio应该显示导致锁定的文件的正确路径。

#2


4  

Close android studio and delete anything in cache

关闭android studio并删除缓存中的任何内容

#3


4  

File > Invalidate cache / restart

文件>无效缓存/重启

works for me!!!

适合我!

错误:更改minSdkVersion时,超时等待锁定构建文件的buildscript类高速缓存

#4


0  

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.

您的build.gradle文件可能包含minSdkVersion的多个语句。可能在defaultConfig {}块和productFlavors {}块中。确保您只在构建文件中声明一次minSdkVersion。

#5


0  

1.Check whether multiple instance of java.exe running then find out why they are running in my case i have opened command prompt it need java instance. open task manager and end task of cmd.exe If you don't want it to further happen remove path from environment variables and use embedded android studio JDK.

1.检查是否运行了多个java.exe实例,然后在我的情况下找出它们运行的​​原因我已经打开命令提示符它需要java实例。打开任务管理器和cmd.exe的结束任务如果你不希望它进一步发生从环境变量中删除路径并使用嵌入式android工作室JDK。

2.Delete lock file in /.gradle/cache goto task manager and close all instance of java.exe In android studio click on file invalidate caches/restart

2.删除/.gradle/cache中的锁定文件goto任务管理器并关闭java.exe的所有实例在android studio中单击文件invalidate caches / restart

#6


0  

Sometimes it was notable to delete filehash.lock file and it will throw an error unable to delete file. So do the following steps

有时值得注意的是删除filehash.lock文件,它会抛出无法删除文件的错误。请执行以下步骤

For Windows machine:

对于Windows机器:

Open Task Manager(Ctrl-Alt-Delete and check Process)

打开任务管理器(Ctrl-Alt-Delete并检查进程)

-> If you run two instance of android studio, Close One (End Task)

- >如果你运行两个android studio实例,关闭一个(结束任务)

-> Then close OpenJDK Platform Binary

- >然后关闭OpenJDK Platform Binary

-> Gradle sync now on AndroidStudio and it will work now

- >现在在AndroidStudio上进行Gradle同步,它现在可以正常工作了

#1


74  

This sounds like it's related to https://issues.gradle.org/browse/GRADLE-2795.

这听起来像是与https://issues.gradle.org/browse/GRADLE-2795有关。

The easiest way to solve this will be to delete everything under C:\Users\Administrator\.gradle\caches. There is a cache.properties.lock that is holding a global lock which is preventing you from running your script.

解决此问题的最简单方法是删除C:\ Users \ Administrator \ .gradle \ caches下的所有内容。有一个cache.properties.lock,它持有一个全局锁,阻止你运行你的脚本。

For Mac OSX the folder is located in ~/.gradle/caches. The Android Studio should show the proper path to the file which is causing the lock anyway.

对于Mac OSX,该文件夹位于〜/ .gradle / caches中。 Android Studio应该显示导致锁定的文件的正确路径。

#2


4  

Close android studio and delete anything in cache

关闭android studio并删除缓存中的任何内容

#3


4  

File > Invalidate cache / restart

文件>无效缓存/重启

works for me!!!

适合我!

错误:更改minSdkVersion时,超时等待锁定构建文件的buildscript类高速缓存

#4


0  

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.

您的build.gradle文件可能包含minSdkVersion的多个语句。可能在defaultConfig {}块和productFlavors {}块中。确保您只在构建文件中声明一次minSdkVersion。

#5


0  

1.Check whether multiple instance of java.exe running then find out why they are running in my case i have opened command prompt it need java instance. open task manager and end task of cmd.exe If you don't want it to further happen remove path from environment variables and use embedded android studio JDK.

1.检查是否运行了多个java.exe实例,然后在我的情况下找出它们运行的​​原因我已经打开命令提示符它需要java实例。打开任务管理器和cmd.exe的结束任务如果你不希望它进一步发生从环境变量中删除路径并使用嵌入式android工作室JDK。

2.Delete lock file in /.gradle/cache goto task manager and close all instance of java.exe In android studio click on file invalidate caches/restart

2.删除/.gradle/cache中的锁定文件goto任务管理器并关闭java.exe的所有实例在android studio中单击文件invalidate caches / restart

#6


0  

Sometimes it was notable to delete filehash.lock file and it will throw an error unable to delete file. So do the following steps

有时值得注意的是删除filehash.lock文件,它会抛出无法删除文件的错误。请执行以下步骤

For Windows machine:

对于Windows机器:

Open Task Manager(Ctrl-Alt-Delete and check Process)

打开任务管理器(Ctrl-Alt-Delete并检查进程)

-> If you run two instance of android studio, Close One (End Task)

- >如果你运行两个android studio实例,关闭一个(结束任务)

-> Then close OpenJDK Platform Binary

- >然后关闭OpenJDK Platform Binary

-> Gradle sync now on AndroidStudio and it will work now

- >现在在AndroidStudio上进行Gradle同步,它现在可以正常工作了