How I configure Intellij Idea 11 for Android, AndroidAnnotations 2.6 and maven
I know there are many many posts about this. This is a summary of how I do, so I can have a place for copy paste.
I couldn't get it to work with processor from classpath, so I use the path from maven repo:
I use <project path> + /target/generated-sources/r
Remove the normal R folder from sources.
Sometimes Idea thinks it knows better and when it updates the maven project it overwrites your changes. The solution I found on the internet is to leave gen as sources and to exclude the folders beneath it. Like so:
Hope someone else finds this useful. Feel free to add or correct me.
1. Create your project with Android Maven Plugin
Read the GettingStarted
You can run this command to get the basic structure:
mvn archetype:generate \ -DarchetypeArtifactId=android-quickstart \ -DarchetypeGroupId=de.akquinet.android.archetypes \ -DarchetypeVersion=1.0.8 \ -DgroupId=com.tagonsoft \ -DartifactId=ExampleApp
Add/Edit the dependency to android:
com.google.android android 4.0.1.2 provided
2. Add AndroidAnnotations to maven pom.xml
com.googlecode.androidannotations androidannotations 2.6 provided com.googlecode.androidannotations androidannotations api 2.6
3. Configure Idea compiler
Like so:I couldn't get it to work with processor from classpath, so I use the path from maven repo:
/work/libs/mvnrepo/com/googlecode/androidannotations/androidannotations/2.6/androidannotations-2.6.jarAdd as processor FQ name:
com.googlecode.androidannotations.AndroidAnnotationProcessorAdd your module to the Processed modules section. Set Generated Sources Directory Name to:
target/generated-sources/annotations
4. Tweak your module to regenerate R file in the new location:
I use <project path> + /target/generated-sources/r
Remove the normal R folder from sources.
Sometimes Idea thinks it knows better and when it updates the maven project it overwrites your changes. The solution I found on the internet is to leave gen as sources and to exclude the folders beneath it. Like so:
Hope someone else finds this useful. Feel free to add or correct me.
Comments
Post a Comment