Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection

2017-06-06 · 🙈Lei · 0条 · 626次

从网上download了一个别人的项目想要运行看一下,在grandle的时候报下面的错误:

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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

这是因为该项目使用的Android Studio版本与当前使用的Android Sudio版本不一致,解决方法是:

打开该项目的build.grandle(Project:)文件,将

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

中的“gradle:2.1.3”替换成当前使用的android studio的版本。


  0