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.
我尝试使用Android annotation框架,因为它看起来很强大。我非常坚持要根据它来配置我的第一个项目。我遵循了wiki的每一步,但是在构建之后它不会生成任何文件。
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.
编辑:找到一个目录。生成了apt_generated,但在构建之后是空的。
1 个解决方案
#1
4
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
这似乎是一个android注释错误,应该在专门的bug跟踪器上报告,这里是http://code.google.com/p/androidannotations/issues es/entry。您还可以使用androidannotation邮件列表http://groups.google.com/group/androidannotations
First, I have a few questions :
首先,我有几个问题:
Which IDE do you use : Eclipse, Netbeans, IntelliJ ? Which version ?
您使用哪个IDE: Eclipse、Netbeans、IntelliJ ?哪个版本?
Do you use Maven, Ant, or only your IDE to build the project ?
您是使用Maven、Ant还是只使用IDE来构建项目?
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.
您的问题可能是由于以下几个原因造成的:注释处理未被触发,AA中的bug,或者在不属于类路径的文件夹中生成的文件。
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.
在Eclipse中,您可以从“窗口>显示视图>错误日志”视图中获得更多信息。如果触发了注释处理,您应该会看到一些关于android注释的消息。
#1
4
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
这似乎是一个android注释错误,应该在专门的bug跟踪器上报告,这里是http://code.google.com/p/androidannotations/issues es/entry。您还可以使用androidannotation邮件列表http://groups.google.com/group/androidannotations
First, I have a few questions :
首先,我有几个问题:
Which IDE do you use : Eclipse, Netbeans, IntelliJ ? Which version ?
您使用哪个IDE: Eclipse、Netbeans、IntelliJ ?哪个版本?
Do you use Maven, Ant, or only your IDE to build the project ?
您是使用Maven、Ant还是只使用IDE来构建项目?
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.
您的问题可能是由于以下几个原因造成的:注释处理未被触发,AA中的bug,或者在不属于类路径的文件夹中生成的文件。
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.
在Eclipse中,您可以从“窗口>显示视图>错误日志”视图中获得更多信息。如果触发了注释处理,您应该会看到一些关于android注释的消息。