Android Studio for beginners

Android Studio for beginners, Part 4: Advanced tools and plugins

A guide to profiling, debugging, and extending your Android Studio applications

1 2 Page 2
Page 2 of 2

Recall that Figure 15 also showed a Find Usages (Codota) menu item. Clicking this menu item provides you with the ability to semantically search all of your repositories for Java code snippets.

The first time you select this menu item, you will be taken to a web page where you must login via Facebook or some other means. After doing so, you'll receive an authentication token that must be entered in Figure 18's dialog box.

androidstudiop4 figure18

Figure 18. Enter the authentication token and click OK.

A second selection of the menu item will take you to a web page for obtaining semantic search (see Figure 19).

androidstudiop4 figure19

Figure 19. Click Get semantic search for your code for a free trial.

Click the Get semantic search for your code button and follow the instructions on the resulting page to receive a free trial of the multi-repository semantic search capability.

Project Lombok

Project Lombok aims to reduce the prevalence of some of the worst offenders of boilerplate (the same textual content that's reused repeatedly) by replacing them with a simple set of annotations.

androidstudiop4 figure20

Figure 20. Click Install to install Project Lombok.

Select Lombok Plugin in the repository list of plugins and then click the Install button. Android Studio proceeds to download and install the plugin. It then relabels Install to Restart Android Studio. Restarting activates Project Lombok.

To see the usefulness of Project Lombok, suppose we add the following minimal Robot class to the source file:

class Robot
   private String name;

The idea with this class is that we'll store the name of the robot being animated and potentially any other information that might be useful, and display this information as a toast (a small message that appears like a tool tip).

We could add a constructor along with getter/setter methods. However, we can let Project Lombok add this boilerplate for us. To do so, accomplish the following tasks:

  1. Right-click on Robot.
  2. Select Refactor from the pop-up menu.
  3. Select Lombok from the next pop-up menu.
  4. Select Default @Data from the next pop-up menu.

You should now observe an @lombok.Data annotation prefixed to the class Robot header. This annotation causes the constructor, getter/setter methods, and more to be auto-generated. You can see all of this boilerplate by repeating the previous steps, except for selecting Delombok instead of Lombok. Source code similar to the following (the domain name will probably be different) is generated by Project Lombok:

class Robot
    private String name;

    public Robot() {

    public String getName() {

    public void setName(String name) { = name;

    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof Robot)) return false;
        final Robot other = (Robot) o;
        if (!other.canEqual((Object) this)) return false;
        final Object this$name =;
        final Object other$name =;
        if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
        return true;

    public int hashCode() {

        final int PRIME = 59;
        int result = 1;
        final Object $name =;
        result = result * PRIME + ($name == null ? 0 : $name.hashCode());
        return result;

    protected boolean canEqual(Object other) {
        return other instanceof Robot;

    public String toString() {
        return "ca.javajeff.w2a.Robot(name=" + + ")";


Android Studio is an amazing environment for developing Android apps. In this short series I've shown you how to obtain and install Android Studio, walked you through a short app-development tutorial, and introduced you to advanced tools and plugins for Android development. I hope you'll consider using Android Studio and its extensible plugin architecture to develop your Android mobile apps.

1 2 Page 2
Page 2 of 2