Search code examples
androidannotationsmanifestclassnotfoundexceptionandroid-annotations

Android Annotations framework doesn't seem to generate anything


I'm trying to use Android annotations framework because it seems quite powerful. I'm quite stuck to configuring my first project based on it. I followed every step of the wiki but it doesn't generate any file after a build.

So when I ask for a generated class from the manifest:

<activity android:name=".MyActivity_"
   android:label="@string/app_name">

I get an exception:

java.lang.ClassNotFoundException

My activity is exactly the same one as in the wiki:

@EActivity(R.layout.main)
public class MyActivity extends Activity {

    @ViewById
    EditText myInput;

    @ViewById(R.id.myTextView)
    TextView textView;

    @Click
    void myButton() {
         String name = myInput.getText().toString();
         textView.setText("Hello "+name);
    }
}

Any ideas?

EDIT: Just found out a directory ".apt_generated" is made but it's empty after the build.


Solution

  • This seems to be an AndroidAnnotations bug, and should be reported on the dedicated bug tracker, here : http://code.google.com/p/androidannotations/issues/entry . You could also use the AndroidAnnotations mailing list, http://groups.google.com/group/androidannotations

    First, I have a few questions :

    Which IDE do you use : Eclipse, Netbeans, IntelliJ ? Which version ?

    Do you use Maven, Ant, or only your IDE to build the project ?

    Your problem may be due to a few things : annotation processing not triggered, a bug in AA, or the files generated in a folder not part of the classpath.

    In Eclipse, you may get more information from the "Window > Show View > Error Log" view. If annotation processing is triggered, you should see some messages about AndroidAnnotations.