Gradle Sync失败 - Android Studio 2.3.1 [英] Gradle Sync Failed - Android Studio 2.3.1

查看:145
本文介绍了Gradle Sync失败 - Android Studio 2.3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码在更新之前工作正常。但在我更新到2.3.1后,它开始出现以下错误,

My code was working fine before the update. But after i updated to 2.3.1, it started to give the following error,

    Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

请帮助。

推荐答案

终于找到了解决方案。

Finally found a solution for this.

指定gradle版本。您可以在Android Studio的文件>项目结构>项目菜单或顶级build.gradle文件中为Gradle版本指定Android插件。插件版本适用于Android Studio项目中内置的所有模块。以下示例将builddle的Android插件从build.gradle文件设置为版本2.3.1:

Specify the gradle version. You can specify the Android plugin for Gradle version in either the File > Project Structure > Project menu in Android Studio, or the top-level build.gradle file. The plugin version applies to all modules built in that Android Studio project. The following example sets the Android plugin for Gradle to version 2.3.1 from the build.gradle file:

 buildscript {
  ...
  dependencies {
    classpath 'com.android.tools.build:gradle:2.3.1'
  }
}

来源:在此输入链接说明

这篇关于Gradle Sync失败 - Android Studio 2.3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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