ligi
ligi

Reputation: 39539

java.io.File cannot be cast to org.gradle.api.artifacts.Configuration

I have a problem in Android-Studio after updating one project to the new gradle-plugin ( 14.0.2):

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.

I tried all suggested things but no success. Also this project builds fine on the console - kinda stuck here. Any hint could help.

Upvotes: 4

Views: 4720

Answers (4)

Basheer AL-MOMANI
Basheer AL-MOMANI

Reputation: 15327

I solve it by the following steps

  1. exit android studio
  2. delete the follwing folders

    • appName/build

    • appName/app/build

    • appName/.gradle

  3. run android studio then go to build > rebuild project

hope this work with you

Upvotes: 2

Audrius Meškauskas
Audrius Meškauskas

Reputation: 21748

The error of this type can be fixed by changing

plusConfigurations += project.configurations.compile

To:

plusConfigurations += [ project.configurations.compile ]

Upvotes: 5

Toby Shepheard
Toby Shepheard

Reputation: 131

As per Ales above, updating to 1.9.17 resolved this for me. I was on 1.9.7 previously.

Specifically, in any appengine projects that you have included, update the versions in your build.gradle file for both the buildscript dependencies and general dependencies. I updated for:

buildscript dependencies:

classpath 'com.google.appengine:gradle-appengine-plugin:1.9.17'

dependencies:

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'

Upvotes: 2

Aleš Krac&#237;k
Aleš Krac&#237;k

Reputation: 31

Had the same issue. I have appengine module in project. Updating gradle config for it to 1.9.17 solved it for me

Upvotes: 3

Related Questions