could not open initscript class cache for initialization script

enter image description here

Error:Could not open initscript class cache for initialization script 'C:\Users\Avishek\AppData\Local\Temp\asLocalRepo14.gradle' (C:\Users\Avishek.gradle\caches\2.2.1\scripts\asLocalRepo14_dkwbdtenxxgt2q2wfe57wj30b\InitScript\initscript). java.io.FileNotFoundException: C:\Users\Avishek.gradle\caches\2.2.1\scripts\asLocalRepo14_dkwbdtenxxgt2q2wfe57wj30b\InitScript\initscript\cache.properties (The system cannot find the file specified)

This error gives when I want to rebuild a project or clean project or run project.

Please someone help me...Thank you...

7 Answers

Don't use Gradle with a fresh version of JDK. It may not support it. In my case, downgrading JDK solved the issue.

2

You should delete "scripts" folder from "C:\Users\user.gradle\caches\2.4\" via this answer. Then refresh gradle from Android Studio. This worked for me.

1

2022 New Answer for Kotlin base projects

  1. Open IntelliJ IDEA CE
  2. Click Create New Project or File/New/Project

Important !!!

  1. Select Kotlin from left side of window.
  2. Select IntelliJ in Build System.
  3. Click Next.
  4. Done. You will not have this error when you run your Kotlin file in the IDE.

enter image description here

1

You may have opened Android Studio twice. In that case close one of the instances and click on Try Again or Synchronize Gradle, or restart Android Studio. It is because the gradle build was not completed and other dependencies like classpath did not initialize at startup.

0

You should check android studio power save menu in file. If it was previously selected, then it should be unselected the power save mode in android studio in file menu. I hope it will be worked.

In my case I have deleted .gradle folder and clean the project on re run the project was working fine.

enter image description here

  1. Close the android studio

  2. Delete this file from your pc C:\Users\Avishek\AppData\Local\Temp\asLocalRepo14.gradle

  3. Delete folder from your pc C:\Users\Avishek.gradle\caches\2.2.1

  4. Your app in .gradle and .idea file is also delete

  5. And start your android studio

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like