Xxx cannot be resolved to a Type
Introduction:
Newly imported eclipse projects often see the error message "XX cannot be resolved to a type. This article will make a summary.
Body:
(1) JDK does not match (or does not exist)
The JDK specified by the project is "jdk1.6.0 _ 18", and currently eclipse uses "jdk1.6.0 _ 22 ". You need to make a simple adjustment in buildpath | libraries.
(2) The jar package is missing or conflicted.
This error is reported if the jar package where "XX" is not found. To solve this problem, you only need to find the corresponding jar package import Project (CTRL + Click to see the jar package name.
In addition, this error is also reported when the same XX occurs. You may need to transfer the package, unpackage, and delete the package.
(3) Why does eclipse search for a project type policy?
In eclipse, the above two items have been compared. If there is no problem, you can still report this error. In this case, you need to operate project | clean... to solve the problem. The reason is the mechanism. For some special reasons, eclipse fails to automatically compile the source code to build/classes (or other classes Directories), leading to the failure to find the type.
These are common errors. The errors I encountered here are caused by file encoding!
The error is similar. Here, only part of the error is intercepted:
Solution:
Right-click a project with an error and choose Properties
Select resource on the left, text file encoding on the right select other: UTF-8, and click Apply.
Xxx cannot be resolved to a Type Error Solution