Intellij 无法在导入时解析符号 [英] Intellij Cannot resolve symbol on import

查看:38
本文介绍了Intellij 无法在导入时解析符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题间歇性地发生在不同的库和不同的项目中.尝试导入库时,会识别包,但无法解析类名.

This problem happens intermittently for different libraries and different projects. When trying to import a library, the package will be recognized, but the class name can't be resolved.

如果在import语句上,我右击->转到 ->包的声明,我看到侧窗格中显示的所有反编译类 -- 包括我需要的那些 --如果我尝试自动完成导入语句,我会注意到下拉列表中没有我需要的类.

If on the import statement, I right-click -> Goto -> the package's declaration, I see all the decompiled classes displayed in the side pane -- Including the ones I need -- If I try to auto-complete the import statement, I notice the class I need is not featured in the dropdown.

我已经尝试过使缓存失效,但不起作用.我找不到任何类冲突——我的类路径中没有其他具有相同包名的 jar 文件.我可以将这个类导入到其他项目中.

I tried invalidating caches already, doesn't work. I cannot find any class conflicts -- there is no other jar file in my classpath with the same package name. I am able to import this class into other projects.

请看屏幕截图:

有人知道吗?

推荐答案

您可以尝试使缓存失效并重新启动 IntelliJ,在许多情况下它会有所帮助.

You can try invalidating the cache and restarting IntelliJ, in many cases it will help.

文件 ->使缓存无效/重新启动

File -> Invalidate Caches/Restart

这篇关于Intellij 无法在导入时解析符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆