代码之家  ›  专栏  ›  技术社区  ›  Damiii

在项目中找不到任务

  •  0
  • Damiii  · 技术社区  · 6 年前

    我有一个与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
    

    我怎么解决这个问题?

    P.S:我的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>'.

    1 回复  |  直到 6 年前
        1
  •  0
  •   Damiii    6 年前

    所以… jcenter()存储库最近似乎遇到了一些问题(服务器问题),这意味着Gradle在构建项目时遇到了一些冲突… 我检查了Twitter中BinTray的状态,等待问题解决,然后用以下命令清除了我的计算机(Mac OS)中Gradle的缓存:

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

    最后,项目正在正确地构建所有内容,没有错误! 希望它能帮助下一个冒险家。 干杯:)