无法打开cp_init重映射的类缓存:无法初始化类

huangapple go评论116阅读模式
英文:

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

问题

我正在开发一个计算器(顺便说一句,我是初学者)。我几乎快完成了,直到我需要格式化我的电脑,然后重新打开Android Studio,第一次它成功打开了。但是现在它无法打开,并显示以下异常:

>构建失败,出现异常。

出了什么问题:

>无法为a4fwtlbt6cgvdv2n0389t2u6w(C:\Users\tambe.gradle\caches\6.1.1\scripts-remapped\sync_studio_tooling_9cltx0zcw96du3cin68bzeyz1\a4fwtlbt6cgvdv2n0389t2u6w\cp_init3607aee355f62839c5e6f549478ccc87)打开cp_init重映射类缓存。

> 无法为初始化脚本'C:\Users\tambe\AppData\Local\Temp\sync.studio.tooling.gradle'(C:\Users\tambe.gradle\caches\6.1.1\scripts\a4fwtlbt6cgvdv2n0389t2u6w\cp_init\cp_init3607aee355f62839c5e6f549478ccc87)打开cp_init通用类缓存。
> 无法初始化类org.codehaus.groovy.vmplugin.v7.Java7

>尝试:
>使用--info或--debug选项运行以获取更多日志输出。使用--scan选项以获取完整洞察力。

...

如果需要异常信息很大,请问我,我会将它粘贴在这里。

...

>获取更多帮助,请访问https://help.gradle.org

>构建在6秒内失败

我非常沮丧,因为我花了很多时间尝试独自完成这个项目,没有任何帮助。拜托,我真的需要帮助!

英文:

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!

答案1

得分: 1

有很多解决方案,但对我来说,将项目结构中的 SDK 替换为嵌入式 SDK,我会留下一个链接:

https://stackoverflow.com/a/62491682/12136602

英文:

There are a lot of solutions but for me, Replacing the sdk from the project structure to the embedded one I'll leave a link:

https://stackoverflow.com/a/62491682/12136602

答案2

得分: 0

这实际上是 Android Studio 中的一个非常常见的崩溃问题,因为它的文件系统相对分散。你应该执行以下步骤:

  1. 导航至 C:\Users\user.gradle\caches\6.1.1\
  2. 复制文件夹 "scripts" 并将其粘贴到一个安全的位置,以防万一出现问题,你可以将其放回原处。
  3. 从目录 C:\Users\user.gradle\caches\6.1.1\ 中删除这个文件夹 "scripts"。
  4. 与 Gradle 文件同步项目,然后就完成了。

当你同步项目时,Android Studio 将会生成新的缓存文件。确保你连接到互联网,如果你在被 Google 禁止的地区之一,要使用 VPN 连接。
更多信息请查看以下链接:

Cache.properties(系统找不到指定的文件)

android studio gradle 刷新失败(系统找不到指定的文件)

英文:

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)

huangapple
  • 本文由 发表于 2020年9月17日 02:14:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/63925758.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定