158

有时 IDE 会因为缓存而出错。在 Eclipse 中,我们可以使用 clean 来解决这个问题。我怎样才能在 IntelliJ 中做到这一点?

4

7 回答 7

271

Depending on the version you are running. It is basically the same just go to
File -> Invalidate caches, then restart Intellij
or
File -> Invalidate caches / Restart

The main difference is that in older versions you had to manually restart as cache files are not removed until you restart. The newer versions will ask if you also want to restart.

Older versions Newer Versions

As seen here on this official Jetbrains help page


You can also try delete caches manually in the system folder for your installed version. The location of this folder depends on your OS and version installed.

Windows Vista, 7, 8, 10
<SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.<PRODUCT><VERSION>

Linux/Unix
~/.cache/JetBrains/<product><version>

Mac OS
~/Library/Caches/<PRODUCT><VERSION>

Read this for more details on cache locations.

于 2013-07-10T03:16:32.473 回答
11

也许不是答案但绝对是答案

如果没有其他方法对您有用,请选择核选项:关闭 IDEA 并使用本地文件系统工具删除“.../.IntelliJIdea/system”目录。

.IntelliJIdea 目录通常位于您的主目录中。您的 IDE 配置位于“.../.IntelliJIdea/config”目录中,所以应该没问题。

显然,这不是执行此操作的“IDEA”方式,JetBrains 将完全不支持。另外 - 我不使用 Android Studio,所以我不知道这是否会导致问题,但你去吧。

当我在启动 IDEA 时遇到问题并且没有其他方法可以让我继续前进时,它对我有用。如果您对丢失所有工作有病态的恐惧,也许可以备份您的整个 .IntelliJIdea 目录>.<

于 2013-07-15T01:12:55.487 回答
2

除了.Intellij*文件,并使缓存失效,如果你真的想清除所有内容,那么还要删除IntelliJ 也生成的.idea文件夹和每个项目的文件......*.iml

于 2018-10-26T20:15:58.977 回答
0

Try this:

Go into Settings (File > Settings or ctrl+alt+S). Under Project Settings, select the "Compiler" node. On the left, uncheck "Clear output directory on rebuild".

Note that this is a per project setting. If desired, change it in the project template settigs (Settings > Other Settings > Template Settings).

于 2013-07-10T03:16:25.317 回答
0

删除违规模块下的“目标”文件夹。然后构建 | 重建项目。还要确保清除 Web 浏览器缓存。

于 2019-03-19T18:37:11.127 回答
0

1) 文件 -> 无效缓存(在 IDE IDEA 中)

2)手动,到 C:\Users\\AppData\Local\JetBrains\IntelliJ IDEA \system\caches 并删除

JetBrains: https ://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs

于 2019-02-12T13:25:42.707 回答
-3

另一个解决方案是 VCS -> Cleanup Project capture

于 2018-06-14T12:39:44.000 回答