Reputation: 21278
AndroidAnnotations 3.0.1.
package com.myapp;
import com.myapp.view.MyView_;
// other imports...
@EActivity(R.layout.start)
public class MyActivity extends Activity {
@ViewById
MyView_ myView;
// using myView
}
And my custom view:
package com.myapp.view;
// imports...
@EView
public class MyView extends TextView {
// ...
}
I have imported my project to Android Studio as Maven project. When I build it from Studio, everything works.
However, when I try to mvn package
it, I get the following error:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /e:/projects/myapp/target/generated-sources/annotations/com/myapp/MyActivity_.java:[80,22] cannot find symbol
symbol: class MyView_
location: class com.myapp.MyActivity_
When I open the MyActivity_.java
generated file, I can see that there are no import for com.myapp.view.MyView_
class (it is there when I build with Studio). Why could that happen?
Compiler configuration:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<annotationProcessors>
<annotationProcessor>org.androidannotations.AndroidAnnotationProcessor</annotationProcessor>
</annotationProcessors>
<compilerArguments>
<AandroidManifestFile>${project.basedir}/src/main/AndroidManifest.xml</AandroidManifestFile>
</compilerArguments>
</configuration>
</plugin>
This does not help.
Upvotes: 0
Views: 912
Reputation: 1561
You shouldn't use generated class on your @ViewById
annotated field. But you still have to use generated one in your layout file :
@EActivity(R.layout.start)
public class MyActivity extends Activity {
@ViewById
MyView myView;
}
<LinearLayout ...>
<my.package.MyView_ .../>
</LinearLayout>
Also, could you confirm you have these dependencies in your pom.xml and you're using Java 6 (as explained on the wiki) ?
<dependencies>
<!-- [...] -->
<dependency>
<groupId>org.androidannotations</groupId>
<artifactId>androidannotations</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.androidannotations</groupId>
<artifactId>androidannotations-api</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
Upvotes: 1