我有一个相对于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/