android - 在项目中找不到任务

标签 android gradle

我有一个相对于gradle的问题,我不知道该如何解决...

如果我在终端上输入以下命令:gradle --scan :<module A>:debugCompileClasspath
这就是给我看的:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project '<root_project_file>'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-core.jar (com.android.tools.build:gradle-core:3.1.2).
 Searched in the following locations:
     https://plugins.gradle.org/m2/com/android/tools/build/gradle-core/3.1.2/gradle-core-3.1.2.jar
> Could not find layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.1.2).
 Searched in the following locations:
     https://plugins.gradle.org/m2/com/android/tools/layoutlib/layoutlib-api/26.1.2/layoutlib-api-26.1.2.jar

我该如何解决?

PS:我的Gradle Android插件是3.1.2和gradle版本:distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
P.S.2:清除gradle的缓存,现在消失了那些错误,但是我现在有这个问题... Task 'debugCompileClasspath' not found in project ':<Module_porject>'.

最佳答案

所以....
看来jcenter()存储库最近有一些问题(服务器问题),这意味着gradle在构建项目时遇到了一些冲突...
我检查了twitter中bintray的状态,等待问题解决,然后使用以下命令清除了计算机(mac os)中gradle的缓存:

rm -rf $HOME/.gradle/caches
./gradlew cleanBuildCache

最终,该项目正确地构建了所有内容,没有任何错误!
希望它将对下一个冒险家有所帮助。
干杯:)

关于android - 在项目中找不到任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50566685/

相关文章:

android - 在Gradle构建中声明本地存储库

maven - 意外标记 &lt;!d(位置 : START_DOCUMENT seen\n&lt;! d...@2:4)

android - 在 android 上使用 android rawquery 和普通查询之间的成本

java - 在 Android 中将数组列表从 Activity 传递到 Java 类

Java:从多部分 POST 请求获取视频文件

android - 加载图形布局时出现缺少主题错误

android - BuildConfig.java中的意外更改,无法还原

python-2.7 - 在Centos 7上使用python 2.7将gradle添加到PATH变量

spring-boot - Spring Boot 1和Gradle:ClassNotFoundException SpringApplicationBuilder

android - 垂直对齐 2 个按钮?