Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

@FragmentById not processed  #438

Description

@sapandiwakar

I have a FragmentActivity which has some Fragments that I have annotated with @FragmentById. It randomly skips processing the @FragmentById annotation. I have checked the generated MyActivity_.java file 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

Activity

  1. pyricau commented on Dec 22, 2012

    @pyricau
    Contributor

    Hi @sapandiwakar

    So if I understand correctly, sometimes @FragmentById is 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 ?

  2. sapandiwakar commented on Dec 22, 2012

    @sapandiwakar
    Author

    Hi @pyricau, thanks for your reply.
    It isn't generated again after a project->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.

  3. pyricau commented on Dec 27, 2012

    @pyricau
    Contributor

    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 @FragmentById may not generate anything without issuing any warning is if the class has an @EXXX annotation that isn't part of the validated elements. But that would mean you'd have a compilation error on the @EXXX annotation.

  4. sapandiwakar commented on Dec 31, 2012

    @sapandiwakar
    Author

    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 @FragmentById and then it works fine until I clean the project or restart Eclipse.

  5. KoljaTM commented on Jan 4, 2013

    @KoljaTM

    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.

  6. KenVanHoeylandt commented on Mar 20, 2013

    @KenVanHoeylandt

    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

  7. Bitphreak commented on May 8, 2013

    @Bitphreak

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions