Search code examples
androidnetbeansandroid-annotations

Setup Netbeans to recognize AndroidAnnotations generated classes in Editor


I have created an Android project in Netbeans (with nbandroid plugin) and I have added the AndroidAnnotations jars in the libs and I have created the custom_rules.xml as explained here: https://github.com/excilys/androidannotations/wiki/Building-Project-Ant. The project compiles and runs without problem. But the generated classes are not recognized by the editor, so no code completion for enhanced classes like MyActivity_. Also the editor shows compilation errors but there are no errors when compile or run.

How can I configure Netbeans to recognize the generated classes?


Solution

  • Well, I have finally solved this:

    Just edit the custom_rules.xml:

    replace

    <property name="generated.dir" value=".apt_generated" />
    

    with

    <property name="generated.dir" value="gen" />
    

    Now Netbeans will see AndroidAnnotations generated sources as any other Android generated file.

    Do not forget to clean & build to generate the files in its new location.