Facing an error while building. Gradle may be corrupt
Asked Answered
A

3

8

I'm getting the following error:

    Error:org.gradle.api.internal.changedetection.state.OutputFilesCollectionSnapshotter$OutputFilesSnapshot cannot be cast to org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter$FileCollectionSnapshotImpl
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.

Can anyone tell me how to solve it?

Agrology answered 27/5, 2016 at 9:11 Comment(5)
So have you tried any of these suggestions?Unsettled
i have killed all java processes and restart but didn't work, can you tell how to kill gradle deamons?Agrology
"./gradlew --stop" Also try cleaning cachesUnsettled
where to run this command?Agrology
On the terminal, inside your project's directory.Unsettled
G
16

Try this solution

1.delete {project dir}/.gradle/1.9

2.Sync Project with Gradle File

**

OR

**

If it doesn't work then try for this solution:

  • Clone project to a new folder

  • Remove .gradle, .idea folders

  • Add as a new project (File > Open > [new folder])

Gorden answered 27/5, 2016 at 9:18 Comment(1)
Glad to help, if it resolved your issue then mark answer as accepted, so it will help others by putting for extra google keystrokes! :)Gorden
C
0

Same Here... follow work for me

  1. After giving error"Re-download dependencies etc..." click on android monitor at bottom end
  2. Click on "Please configure android SDK"
  3. Click on Project at Left Side Menu
  4. Give another Build Version and Build Version Name
  5. Copy ***

build.gradle code from another successful project and paste"replace" all in this error'd gradle and click sync


  1. Gradle will start built... Successfully but time consumed
Communalism answered 3/2, 2017 at 18:44 Comment(1)
What do you mean by "please configure android sdk"?Diarthrosis
W
0

In my case, I had to change the following:

apply plugin: 'com.android.application'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

I brought apply plugin: 'org.jetbrains.kotlin.android' at the bottom of the list.

So it is now

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'org.jetbrains.kotlin.android'
Wynnie answered 19/9, 2024 at 15:38 Comment(1)
In my opinion, plugin ordering doesn't matter.Skirting

© 2022 - 2025 — McMap. All rights reserved.