[英]IntelliJ : Cannot resolve method 'run(java.lang.Class, String[])'
I've encountered a problem where on all of my applications, there's a red cross on the top right.我遇到了一个问题,在我所有的应用程序中,右上角都有一个红叉。 I can run it, but the cross doesn't seem to go away.
我可以运行它,但是交叉似乎没有go。
I've opened the run/debug configurations and it says Warning: Main method not found.我打开了运行/调试配置,它显示警告:找不到主要方法。 I don't understand why it's not found when I already have a corresponding main class and method for each and every application.
我不明白为什么当我已经为每个应用程序都有相应的主要 class 和方法时找不到它。
I tried to close the project, restarting IntelliJ, restarting my laptop, refreshing my desktop, refresh Gradle by clicking Reimport All Gradle Projects, rebuild the project and clicking Invalidate Caches / Restart.我尝试关闭项目,重新启动 IntelliJ,重新启动笔记本电脑,刷新桌面,通过单击重新导入所有 Gradle 项目刷新 Gradle,重建项目并单击无效缓存/重新启动。 I also tried other suggestions I found on StackOverflow such as deleting the.idea folder.
我还尝试了在 StackOverflow 上找到的其他建议,例如删除 .idea 文件夹。 Nothing.
没有。 The red cross still shows up.
红十字仍然出现。 I've also realized that I do not have the out folder in all of my Applications.
我还意识到我的所有应用程序中都没有 out 文件夹。
File->Project structure ->SDKs文件->项目结构->SDKs
Try to copy src and gradle folders and buil.gradle and settings,gradle files in separate folder.尝试复制 src 和 gradle 文件夹和 buil.gradle 和设置,gradle 文件在单独的文件夹中。 Then open this new folder as new project in intellij.
然后在 intellij 中将这个新文件夹作为新项目打开。 Then intellij will propose Import as gradle project... - push it.
然后 intellij 将建议 Import as gradle 项目... - 推动它。 If problem remained see you build.gradle
如果问题仍然存在,请见 build.gradle
In Project Settings, First make sure SDK path is correct.在项目设置中,首先确保 SDK 路径正确。 Preferably install and use your own SDK.
最好安装和使用您自己的 SDK。 Then use the same SDK in Project and Modules in Project Settings.
然后在 Project Settings 中的 Project 和 Modules 中使用相同的 SDK。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.