Friday, May 1, 2015

Android Annotation Setup in Android Studio


Android Annotations is an Open Source framework that speeds up Android development. It takes care of the plumbing, and lets you concentrate on what's really important. By simplifying your code, it facilitates its maintenance.

Not much about this step-by-step guide has changed but since there were developer having problems getting everything to work I decided to post an updated version. This is what I did in order to get things running with a new project created in Android Studio (version 1.1.0).

The file we are going to modify is the build.gradle file located in the app folder of your project, not the one found in the root.
Step 1
First we need to apply the android-apt plugin and add a dependency to it. Be sure to add this below the line that applies the android plugin. Note that the order here is important!


Step 2
Now hand it the following arguments. Remember to replace com.example.package.name with the correct package name for your project.



Step 3
Finally add dependencies to AndroidAnnotations.


The contents of app/build.gradle should now look something like this.


Step 4
Now rebuild your project and it should run fine! Now you are all set to start using AndroidAnnotations. And when you do, don’t forget to add that underscore to your Activities in the manifest!


No comments:

Post a Comment