更新到 Android Studio 2.3 Canary 3 后 Gradle 构建失败 [英] Gradle build failing after update to Android studio 2.3 Canary 3

查看:29
本文介绍了更新到 Android Studio 2.3 Canary 3 后 Gradle 构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的项目的 android studio 版本从 2.3 Canary 2 更新到 2.3 Canary 3.从那时起,gradle 构建每次都失败并出现此错误:

I've recently updated the android studio version of my project from 2.3 Canary 2 to 2.3 Canary 3. Since then the gradle build is failing every time with this error:

错误:无法找到方法org.gradle.api.tasks.Sync.getInputs()Lorg/gradle/api/internal/TaskInputsInternal;".此意外错误的可能原因包括:

  • Gradle 的依赖项缓存可能已损坏(这有时发生在网络连接超时之后.)重新下载依赖项并同步项目(需要网络)
  • Gradle 构建进程(守护进程)的状态可能已损坏.停止所有 Gradle 守护进程可能会解决这个问题.停止 Gradle 构建过程(需要重新启动)
  • 您的项目可能正在使用第三方插件,该插件与项目中的其他插件或项目请求的 Gradle 版本不兼容.
  • Error:Unable to find method 'org.gradle.api.tasks.Sync.getInputs()Lorg/gradle/api/internal/TaskInputsInternal;'. Possible causes for this unexpected error include:

    • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
    • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
    • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

    我在谷歌上搜索过,并没有找到完全像这样的解决方案,但那些类似的解决方案不起作用.有大佬知道怎么解决吗?

    I've searched google and not found solutions like this exactly but those that are similar are not working. Does anyone know how to fix it?

    推荐答案

    解决方案是在构建 gradle 面板中选择Use default gradle wrapper (recommended)"选项,如下图所示.现在您可以使用 gradle 3.2(在您的 gradle-wrapper.properties 中)和 android gradle:2.3.0-alpha3 或 beta1 作为撰写本文的时间

    The solution is to select "Use default gradle wrapper (recommended)" option in the build gradle panel like the image below. Now you can build with gradle 3.2 (in your gradle-wrapper.properties) and android gradle:2.3.0-alpha3 or beta1 as the time of writing

    如果您在使用 File -> Invalidate Cache/Restart 时遇到问题,请不要忘记使缓存失效

    这篇关于更新到 Android Studio 2.3 Canary 3 后 Gradle 构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆