Gradle Sync失败 – Android Studio 2.3.1
我的代码在更新之前工作正常。 但在我更新到2.3.1后,它开始出现以下错误,
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:- 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.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
请帮忙。
终于找到了解决方案。
指定gradle版本。 您可以在Android Studio的“文件”>“项目结构”>“项目”菜单或顶级build.gradle文件中为Gradle版本指定Android插件。 插件版本适用于Android Studio项目中内置的所有模块。 以下示例将builddle的Android插件从build.gradle文件设置为版本2.3.1:
buildscript { ... dependencies { classpath 'com.android.tools.build:gradle:2.3.1' } }
来源: 在此处输入链接说明