繁体   English   中英

Gradle:无法解析配置“:classpath”的所有依赖项

[英]Gradle: Could not resolve all dependencies for configuration ':classpath'

我的 android 工作室一直遇到问题。 任何时候我尝试运行一个应用程序,任何应用程序(甚至是空白的),都会发生错误。 它总是以这种形式:

注意:翻转是应用程序的名称......

Error: Gradle: A problem occurred configuring root project 'Flip'. 
     - Could not resolve all dependencies for configuration ':classpath'. 
     - Could not resolve com.android.tools.build:gradle:1.1.0.
        Required by:
                   :Flip:unspecified

我已经搜索了几天的解决方案无济于事,它使我的 android 工作室几乎毫无用处。

将最新版本的android studio更新为2.1.2并进行更改

classpath 'com.android.tools.build:gradle:2.1.2'

转到build.gradle(项目),将鼠标悬停在类路径上并将版本更新为建议的更新。

如果上述建议不起作用,则表示存在同步问题。 只需这样做:

文件>使缓存无效并重新启动

如果其他所有设置都正确,那么它肯定会在那之后工作。

我的错误是:

Could not resolve all dependencies for configuration ':classpath'. > Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository()

在 m 项目android/.gradle/buildOutputCleanup.lock中有一个锁定文件,我需要在继续运行项目之前将其删除(我正在使用 react-native)

但实际上它并没有被删除,它一直说这个文件在Java SE中打开

所以,首先我必须运行(我使用的是 Windows):

tasklist | findstr java

因此,所有正在运行的 Java 实例都将显示其 PID。 然后通过 PID 杀死每个进程:

taskkill /F /PID  <PID>  // It will be like taskkill /Fn /PID 23172

然后我能够删除该锁定文件,我可以重建项目

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM