将一个项目更新为新的gradle-plugin(14.0.2)后,我在Android-Studio中遇到问题:
Error:Cause: java.io.File cannot be cast to org.gradle.api.artifacts.Configuration
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 may be corrupt.
<a href="stopGradleDaemons">Stop Gradle daemons and sync project</a></li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
我尝试了所有建议但没有成功。此项目在控制台上构建良好 - 有点卡在这里。任何提示都有帮助。
答案 0 :(得分:4)
可以通过更改
来修复此类错误plusConfigurations += project.configurations.compile
要:
plusConfigurations += [ project.configurations.compile ]
答案 1 :(得分:3)
有同样的问题。我在项目中有appengine模块。将gradle配置更新为1.9.17为我解决了它
答案 2 :(得分:2)
根据上面的Ales,更新到1.9.17为我解决了这个问题。我以前是1.9.7。
具体来说,在您包含的任何appengine项目中,更新build.gradle文件中的版本以获取buildscript依赖项和一般依赖项。我更新了:
buildscript依赖项:
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.17'
依赖关系:
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.17'
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.17'
compile 'com.google.appengine:appengine-endpoints:1.9.17'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.17'
答案 3 :(得分:2)
我通过以下步骤解决它
删除以下文件夹
appName / build
APPNAME / app/build
APPNAME / .gradle
运行android studio然后转到build
&gt; rebuild project
希望这项工作与您合作