Using AndroidAnnotations with Scala and Gradle
Is it possible to use AndroidAnnotations with the Scala programming language and the Gradle build system? When I try to integrate AndroidAnnotations into my existing Android/Scala/Gradle project, then compilation fails because the generated underscore classes (e.g. MyActivity_) cannot be found.
Here are some useful starting points and references:
- http://www.scala-lang.org/node/4773 (2010-01-06)
- http://www.scala-lang.org/sid/5 (2010-01-27)
- http://code.google.com/p/andro开发者_开发问答idannotations/wiki/Configuring (2011-07-28)
- http://docs.jboss.org/hibernate/validator/4.1/reference/en-US/html/ch08.html#d0e2816 (2010?)
- Java 6 annotation processing configuration with Ant (2010-09-05)
- http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javac.html#processing
- http://ant.apache.org/manual/Tasks/apt.html
- Generating JPA2 Metamodel from a Gradle build script (2011-06-22)
- http://download.oracle.com/javase/1.5.0/docs/guide/apt/GettingStarted.html
During my quest to solve this problem, I added some research links to my original question post. The AndroidAnnotations annotation processor generates source code (Java files). Annotation processors in general seem to operate at the source code level (and not class files). I am expecting AndroidAnnotations to generate Java code from Scala source files. Scala doesn't seem to support the Java annotation processing tool. So my answer to this question would be: it is not possible to use AndroidAnnotations with Scala source code. However, AndroidAnnotations may still be used in the Java source code in a Scala mixed-source project.
Regarding Gradle (without Scala), it seems that someone managed to use it with AndroidAnnotations, here: Adapt AndroidAnnotations Maven settings to Gradle
精彩评论