Repository navigation
@FragmentById not processed #438
Description
Activity
So if I understand correctly, sometimes
@FragmentByIdis taken into account, and sometimes it isn't. When you do a "project > clean", is it generated or not ? If you "touch the original activity file" and then it gets generated, what gets it to stop being generated ?By the way, which version of AndroidAnnotations are you using ?
Hi @pyricau, thanks for your reply.
It isn't generated again after aproject->clean. I noticed that it gets removed mostly when I create a new activity or add some more files to the project. I am using android-annotations 2.7.Could you confirm that you get no compile time error at all in the whole project? By looking at the code, the only case where
@FragmentByIdmay not generate anything without issuing any warning is if the class has an@EXXXannotation that isn't part of the validated elements. But that would mean you'd have a compilation error on the@EXXXannotation.I can confirm that there is no compile time warning in the whole project. I noticed that this happens every time I start Eclipse. I then have to touch all the files that have
@FragmentByIdand then it works fine until I clean the project or restart Eclipse.I noticed the same with the @PREF annotation. After a project->clean the required code would not be generated, when I do any change on the class, it will be regenerated correctly. Also, it seems the methods are generated in a different order in refresh and clean case.
This is in Eclipse Helios btw.
I opened #450 because I am not sure if this is the same problem here.I had a similar problem and fixed it by changing this:
@FragmentById(R.id.userFormFragment) protected UserFormFragment_ mUserFormFragment;Into this:
@FragmentById(R.id.userFormFragment) protected UserFormFragment mUserFormFragment;(note the underscore difference)
It took me a long time to figure out as a @PREF annotation /does/ require the generated type to be used and Eclipse gave me no error message.
[edit] I had a similar problem with a custom view linked as SongTextView_ rather than SongTextView.
I am using version 2.7.1
I am having the same issue with @FragmentByTag. I tried using both the annotated class and the generated class. ie... removing or adding the trailing '_'. Neither works and I get the following error in eclipse
Unexpected error. Please report an issue on AndroidAnnotations, with the following content: java.lang.NullPointerException
at com.googlecode.androidannotations.processing.FragmentByTagProcessor.process(FragmentByTagProcessor.java:68)
at com.googlecode.androidannotations.processing.ModelProcessor.process(ModelProcessor.java:102)
at com.googlecode.androidannotations.AndroidAnnotationProcessor.processAnnotations(AndroidAnnotationProcessor.java:505)
at com.googlecode.androidannotations.AndroidAnnotationProcessor.processThrowing(AndroidAnnotationProcessor.java:367)
at com.googlecode.androidannotations.AndroidAnnotationProcessor.process(AndroidAnnotationProcessor.java:341)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139)
at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:110)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159)I am using
AndroidAnnotations 2.7.1
Eclipse 3.8.1
on Ubuntu
I have a
FragmentActivitywhich has someFragments that I have annotated with@FragmentById. It randomly skips processing the@FragmentByIdannotation. I have checked the generatedMyActivity_.javafile and it doesn't set the fragment annotated with@FragmentById. The annotations are processed correctly if I later touch the original activity file.I am using Eclipse Juno