My Intellij has randomly started to just not display my classes in the correct way for some reason. It was working perfectly fine just a few hours ago, and all of the sudden it doesn't work anymore. All of my Bukkit methods are throwing errors even when I import spigot, and the autocomplete feature isn't working properly. Any help is appreciated.
This is due to unmet dependencies/inability to resolve the methods you are calling.
Check your imports, dependencies, installed JDKs, jkd used by intellij, and check your dependencies' versions.
If all fails, you can create a new project and move the source files to the new project. That will act as a hard reset of everything. (kinda of a last resort but...yeah)
Related
In my rest API projects, IntelliJ suddenly stopped recognizing imports from the packages org.springframework.http and org.springframework.web. For example, it gives me the red squiggleys when I try to create an instance of ResponseEntity or use the #RestController annotation. I also get the red squiggleys under the corresponding import statements with the message “Cannot resolve symbol” when I hover my cursor over them.
I click the light bulb and select “add Maven dependency”, but IntelliJ cannot find any to add. Even if it could, the proper Maven dependencies are already present in the pom.xml, but they are grayed-out as if they aren’t referenced anywhere. Manually specifying different versions of the dependencies does nothing. Reimporting the project does nothing. Cloning the repo again and starting a new project didn’t help. Neither did invalidating the caches, deleting the entire .m2 directory, updating IntelliJ, restarting my machine, or fiddling with the interpreter.
The code builds and runs as expected without any problems both in terminal and in the IDE. I have no idea why the IntelliJ seems so confused. This is only happening on my machine, and I can’t think of anything I could have done to cause it. Nobody else on the team has seen this issue. It’s not isolated to any particular repo. It happens any time I try to import from these specific packages. It’s been bugging me all week, and my teammates are just as bewildered as I am. Any suggestions?
Additional Info:
Java 11.0.6
Latest versions of Maven and IntelliJ
macOS Mojave
Update
I decided to once again delete my entire .m2 directory and the .idea directory for my project. I have done this multiple times over the past week with no results. This time, when I reimported the project I found the aforementioned org.springframework.web and org.springframework.http imports are now being recognized correctly. However, IntelliJ is now failing to recognize some of the other imports, such as lombok.
I actually had this particular version of the problem last week for several hours. I then took a short break and opened my laptop to find that everything was magically back to normal. A few days later, I started having the error that I described above. These unrecognized imports seem to appear and disappear at random, regardless of the project I am working in or any changes to the code.
Let me reiterate that there is nothing wrong with the code. IntelliJ builds and runs it flawlessly, even with all the red squiggleys. There is something wonky going on with the editor. I have included a screenshot below of the current state.
Solved
I decided to uninstall and reinstall IntelliJ. which resolved the issue.
This can happen for lots of reasons:
Try the following:
(Mac users) Right click on the project -> Maven -> reimport
If that doesn't work:
Delete `.idea` folder and re import the project.
Its located in the root of the project. like this one
za$ ls .idea/
.name compiler.xml encodings.xml httpRequests/ misc.xml vcs.xml workspace.xml
If that doesn't work, make sure the jar is loaded and you can see it listed as a dependency, or import it manually. see this questions:
https://stackoverflow.com/questions/1051640/correct-way-to-add-external-jars-lib-jar-to-an-intellij-idea-project
If that doesn't work:
Delete all versions of the jar(that having the issue) from ./m2
folder. Or make sure to specify a specific version in pom.xml
Refer to the image link here Exclude from import and Completion
In Intellij settings File-> Settings, go to Editor -> General -> Auto Import -> Java section -> Exclude from import and completion. Remove those classes you have accidentally put there. It might have ever happened coz you have ever pressed the wrong button when there is an auto-suggest from Intellij.
Actually, I have the same problem a few days ago. And that is how I resolved it.
I am using eclipse Kepler with jdk 1.6, problem is with particular system, on other system everything is fine.
I have created a java project in eclipse, in main class i have some variables(constraints) on which the whole project works, for purpose of testing, when i am changing the variables data and executing eclipse giving result on some previously fixed variables, don't know why this silly behavior.
If somebody knows the issue please help me out.
It depends on your project. If your project need to re-build for every change you made, than maybe you have turned off live-build in eclipse.
If your project does not need any building, may be it is because of environment in which you are working. sometimes it happens. just restart eclipse. may be it helps. but if problem still persist, let me know more details about your project and eclipse.
Thanks,
So I have a project that works totally fine in one workspace on my machine. I push it to the repository so everyone else can work on it. I go to pull it down making sure all the changes are good. I import the project into a new workspace and using eclipse with autobuild on it produces no errors.
I go to the command line and run ant clean release on the project and right before it gets to run crunch on the assets the build fails with a mulitple dex files define error. Ive checked the project high and low and compared to the other copy of it in the original workspace but for what ever reason I cant get it to build. I erase the bin and gen folders and remove all the imports and basically leave just the project, run clean in eclipse, and still get a dex define error related to one of the lib projects classes. Ive tried to find where extra copies could be but I dont find anything.
googling around for the past few days hasnt helped as the normal solutions to such a problem havent worked for me. So what is the best way to figure out where the extra class definitions are coming from so I can get rid of them and fix the repository so I can use it correctly. I have a feeling its related to one of the files in the project that I should be excluding in my gitignore but Im not sure which that would be. Any help on the matter would be greatly appreciated cause this has eaten quite a bit of time of just messing around.
When you have more than one class with the same package name this error would raise.
One of the common source of this issue is when you have for example different version on the same library.
For example your add ActionbarSherlock which in 'libs forder has it's own support library and also your project has another version of support library in it's libs folder. In such a cases you should put one version of support library.jar to all different libraries that you using it.
I hope this could help you.
I didnt find the root of the problem but I figured out a fix. I moved all the support libraries to a new root folder completely away from the android project. Once I did that and cleaned everything I then ran ant clean release and the project built fine.
I'm working on Eclipse (3.6.2, 3.7.2, 4.2.0) with GWT plugin 2.4.0.
In these days, I found the code assist does not work WITHIN EVENT HANDLERS of an EntryPoint class. I reinstalled whole environment, then it worked at that time. But today it get insane again. I don't see any reason for it.
Does anyone experienced such a phenomenon?
This occurs for me when I haven't imported the various classes yet, like ClickHandler.
Eclipse is giving me a few problems.
After a cold start and the loading of android libs, Eclipse underline the import statements or says that java.lang.Object couldn't be found.
Closing it and reopening often fix the problem. If it doesn't, another close-open fix it definitely. But it shows at each cold-start.
It also gives
"The type java.lang.Enum cannot be resolved. It is indirectly referenced from required .class files"
"The project cannot be build until build path errors are resolved"
But if i restart the build path errors and the enum problem are not show any more(sometimes the enum proble got fixed some time after eclipse's loading finished)
"Project 'xxx' is missing required source folder: 'gen' "
that should be generated automatically generated while building, and still restarting will fix them
In addition, in many projects, while building or cleaning, eclipse says that it couldn't delete the bin/. directory. I noticed that that directory is read-only, and if i try to remove the attribute(even from dos), it immediately return to read-only.
This problems aren't show-stoppers, i still can code and i still can get my apps exported, but it is quite annoying to have to restart eclipse a few times before being able to use it(and eclipse isn't that fast at opening), and i would really know how to fix it.
I searched in the net a bit, but i dind't found nothing useful or that worked.
Is there a way to fix them?
I didn't "unistalled"(it is just stored in a directory) Eclipse, since i should then reinstall android sdk, mercurial plugin, and re download and set up a few libraries i use in quite all my project, and i really hope there is another way.
final notes:
everything works when this problems doesn't show: the app works, logcat too, the right device is used to install the app, so i think java and android sdks are installed just right
I had that problem before so I just saved my projects to a different file and uninstalled everything ( java, android sdk, eclipse ). When I reinstalled it all I put the android sdk on the root of my c drive as I have a windows machine and then instead of picking where java was installed I let it do its own thing. I dont use a mercurial plug in but your "read only" problem could be related to that. Its possible your downloading files that are "read only" and there for you have no way to alter them. Im guessing since you said youve been programing you already know how to set the build paths and stuff. It might just be where everything is installed or something silly like privilege settings on your machine.
What were you using the mercurial plug in for anyway? just curious :)
Have you included the java lib in your project or? For a couple of weeks ago I sat with an project where i absolutly needed some of the methods, so because android just have some of the java lib I imported the need libs and used that.