简体   繁体   English

为什么在Intellij上编辑配置时看不到主方法上的符号?

[英]Why do I see cannot resolve symbol on main method while editting configurations on Intellij?

I am new to IntelliJ IDEA, and I am trying to edit configurations for an imported Gradle project. 我是IntelliJ IDEA的新手,我正在尝试编辑导入的Gradle项目的配置。 It says "Cannot resolve symbol udacity." 它说“无法解决符号udacity”。

这是它的图片

What can I do to fix it? 我该怎么办才能修复它?

Thanks :) 谢谢 :)

So you have git cloned the project to a folder ud282-master and there is a subfolder in there Project 1 - TicTacToe . 所以你有git将项目克隆到文件夹ud282-master中, Project 1 - TicTacToe中有一个子文件夹ud282-master

In Intellij if you have another project open go to File -> New -> Project From Existing Sources... or if you don't have a project open go to Import project . 在Intellij中,如果您打开另一个项目,请转到文件 - >新建 - >项目从现有源...或者如果您没有打开项目,请转到导入项目

In both cases pick the folder Project 1 - TicTacToe to import from because that's where the gradle files are. 在这两种情况下,选择要导入的文件夹Project 1 - TicTacToe ,因为这是gradle文件所在的位置。 In the next screen pick Import project from external model -> Gradle . 在下一个屏幕中, 从外部模型 - > Gradle中选择Import project

Then you should be able to make a new Run Configuration specifying in Use classpath or module the module Project_1_-_TicTacToe_main and not Project 1 - TicTacToe . 然后,您应该能够在使用类路径或模块中指定模块Project_1_-_TicTacToe_main而不是Project 1 - TicTacToe Then just pick com.udacity.Game from the dropdown. 然后从下拉列表中选择com.udacity.Game

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM