Could not open cp_init remapped class cache : Could not initialize class

Viewed 3996

I was working on a calculator (I'm a beginner btw). I almost finished it until I needed to format my PC and after reopening Android Studio for the first time it opened, but now it doesn't and shows this exception:

FAILURE: Build failed with an exception.

What went wrong:

Could not open cp_init remapped class cache for a4fwtlbt6cgvdv2n0389t2u6w (C:\Users\tambe.gradle\caches\6.1.1\scripts-remapped\sync_studio_tooling_9cltx0zcw96du3cin68bzeyz1\a4fwtlbt6cgvdv2n0389t2u6w\cp_init3607aee355f62839c5e6f549478ccc87).

Could not open cp_init generic class cache for initialization script 'C:\Users\tambe\AppData\Local\Temp\sync.studio.tooling.gradle' (C:\Users\tambe.gradle\caches\6.1.1\scripts\a4fwtlbt6cgvdv2n0389t2u6w\cp_init\cp_init3607aee355f62839c5e6f549478ccc87). Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.

...

Exception is very large if it's needed ask me, I'll paste it here.

...

Get more help at https://help.gradle.org

BUILD FAILED in 6s

I'm so frustrated because I spent a lot of hours trying to figure out how to do this project on my own with no help. Please, I really need it!

2 Answers

this is actually a very common crash with android studio since it has a rather scattered file system. you should do: 1-Navigate to C:\Users\user.gradle\caches\6.1.1\

2-Copy the folder "scripts" and paste it somewhere safe just in case anything went wrong you will place it back

3-Delete this folder scripts from the directory C:\Users\user.gradle\caches\6.1.1\

4- Sync Project with Gradle Files and you are done.

When you sync your project Android Studio will generate new cash files. make sure you are connected to the internet and if you are in one the regions that are banned by google have a VPN connected. for more info check out these:

Cache.properties (The system cannot find the file specified)

android studio gradle refresh failed (The system cannot find the file specified)

Related