eclipse导入项目报错:The import *** cannot be resolved

问题

eclipse导入Gradle项目,提示The import *** cannot be resolved问题

原因1

原来使用JDK和现在使用的JDK不同造成的buildpath不对

解决方法:

1、右键项目 --> BuildPath --> Configura Build Path…
eclipse导入项目报错:The import *** cannot be resolved
eclipse导入项目报错:The import *** cannot be resolved

3、选中Remove掉,重新为该项目选择一个JRE

4、project----clean,全部的包都找到了。

原因2

build.geadle中没有添加相关依赖

解决方法:

打开项目build,gralde 添加相关依赖