Repository navigation
Generated classes: cannot be resolved to a type #257
Description
Activity
I have noticed that kind of issue too. Clearly, Eclipse has some problems with import resolving, when you clean the project. It won't happen if you use fully qualified names and no imports. Weird. We need to dive into eclipse to understand what happens.
That's a good suggestion: I'll used fully qualified names. In the meantime, I'll keep my fingers crossed that you find some miracle solution.
Incidentally, I'm still using Eclipse Indigo. Does the problem still occur in Juno?
I don't know, I'm still using Indigo. We need to find out.
I've been using Juno since Thursday, and literally as I'm typing this, the same problem occurred. Too bad!
I have same problem. Eclipse can't resolved FooBarFragment_ .
Eclipse version is 3.7.2 and 4.2 at My MacBookAir.
But same environment other one (MacBookPro) is works good...
I can't isolate the problem.vvakame, does the problem appear on your MBP when you clean the project? This seems to consistently raise the issue within my project.
@vvakame At least it's good to know that you have an environment where it works right. Do you have a different java version ?
It would really be great if you could isolate the problem :)
I have some good news: the bug haven't been fixed yet, but at least we can isolate it. This kept bugging me, so I took the time to slim down an existing project until I could find the exact conditions to reproduce it.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=350378#c6
This clearly isn't an Android bug, and probably not an AndroidAnnotations bug. It seems to be Eclipse related. Let's see if that can be solved.
Awesome that you could figure out where it's coming from and you could provide a minimum working example. I've subscribed to the issue and keep my fingers crossed!
:)
I ended up creating a new issue in Eclipse, Juno related : https://bugs.eclipse.org/bugs/show_bug.cgi?id=387956 . The use case even related to AndroidAnnotations anymore.
Meanwhile, to prevent this, you can :
- Remove the need for imports on generated files, by putting the files in the same package or using qualified names
- Stop using annotations with constant references in classes where you import generated files. Either by relying on the element name convention, or by using the new
resName()annotation parameter.
Actually, the simplest way may be to do an import of the whole package for the generated class :)
Instead of
import com.company.MyBean_;, just doimport com.company.*;I'm trying to move things forward on the Eclipse side, but they have a lot of things to do.
I have updated the FAQ with this issue.
This has been reported on the eclipse side. Not related to an AA bug.
To work with fully qualified class names does not work for me. I always get a "NoClassDefFoundError" when i try to start an activity with "de....MainActivity_.intent(this).start()". Any suggestions?
I have a project containing several Activities and Fragments that are generated using AndroidAnnotations. It worked great until I began to notice strange errors:
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:
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.