Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 417
Romain Piel Avatar asked Aug 22 '11 15:08

Romain Piel


1 Answers

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.

like image 183
Pierre-Yves Ricau Avatar answered Oct 15 '22 07:10

Pierre-Yves Ricau