-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Generated classes: cannot be resolved to a type #257
Description
I have a project containing several Activities and Fragments that are generated using AndroidAnnotations. It worked great until I began to notice strange errors:
FragmentActiveAction_ cannot be resolved to a type StartActivity.java /myproject/src/com/myproject/activities line 55 Java Problem
FragmentZoneList_ cannot be resolved to a type StartActivity.java /myproject/src/com/myproject/activities line 215 Java Problem
FragmentZoneList_ cannot be resolved to a type StartActivity.java /myproject/src/com/myproject/activities line 215 Java Problem
The import com.myproject.activities.ZoneMapActivity_ cannot be resolved FragmentZoneList.java /myproject/src/com/myproject/fragments line 22 Java Problem
The import com.myproject.fragments.FragmentActiveAction_ cannot be resolved StartActivity.java /myproject/src/com/myproject/activities line 20 Java Problem
The import com.myproject.fragments.FragmentZoneList_ cannot be resolved StartActivity.java /myproject/src/com/myproject/activities line 22 Java Problem
ZoneMapActivity_ cannot be resolved to a type FragmentZoneList.java /myproject/src/com/myproject/fragments line 77 Java Problem
Oddly, I can very easily fix these problems by simply deleting the import declaration and having it automatically added again (through Eclipse's organize imports save action). My project then compiles and runs without any problems.
When cleaning the project, the same errors return. The generated java files are nevertheless present, Eclipse just doesn't "see" them. Here's Eclipse's log output after cleaning the project:
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.895
!MESSAGE Starting AndroidAnnotations annotation processing!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.897
!MESSAGE Dummy source file: file:///C:/Users/Paul/workspace/myproject/.apt_generated/dummy1340976069897.java!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.898
!MESSAGE AndroidManifest.xml file found: C:\Users\Paul\workspace\myproject\AndroidManifest.xml!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.960
!MESSAGE Number of files generated by AndroidAnnotations: 13!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.961
!MESSAGE Generating source file: com.myproject.rest.ApiClient_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.967
!MESSAGE Generating source file: com.myproject.ActionApp_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.970
!MESSAGE Generating source file: com.myproject.fragments.FragmentActiveAction_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.975
!MESSAGE Generating source file: com.myproject.fragments.FragmentListDialog_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.980
!MESSAGE Generating source file: com.myproject.fragments.FragmentMap_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.983
!MESSAGE Generating source file: com.myproject.fragments.FragmentActionOne_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.989
!MESSAGE Generating source file: com.myproject.fragments.FragmentZoneInfoDialog_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.992
!MESSAGE Generating source file: com.myproject.fragments.FragmentZoneList_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:09.995
!MESSAGE Generating source file: com.myproject.activities.AccountActivity_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:10.000
!MESSAGE Generating source file: com.myproject.activities.HistoryActivity_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:10.028
!MESSAGE Generating source file: com.myproject.activities.LoginActivity_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:10.067
!MESSAGE Generating source file: com.myproject.activities.StartActivity_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:10.071
!MESSAGE Generating source file: com.myproject.activities.ZoneMapActivity_!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:10.075
!MESSAGE Time measurements: [Whole Processing = 178 ms], [Generate Sources = 115 ms], [Process Annotations = 33 ms], [Find R Classes = 18 ms], [Validate Annotations = 8 ms], [Extract Manifest = 4 ms], [Extract Annotations = 0 ms],!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:10.082
!MESSAGE Time measurements: [Whole Processing = 0 ms],!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2012-06-29 15:21:10.084
!MESSAGE Time measurements: [Whole Processing = 0 ms],
I am using ADT 20 with platform tools 12. There are some other annotation libraries being used in the project: ORMLite, Simple Framework and Spring.