Android Studio + JIRA (and other bug tracking tools)

3 min read

All Android developers, new and seasoned, want to be as productive as possible. While not having to worry too much about trivial things such as moving JIRA tickets over from column to column (from ToDo to In Progress, to In Review, etc.)

Not every one knows this, and even the ones that know about it may not be using this, but there is this awesome feature (no plugin needed) in Android Studio (AS) that allows us to connect our Android Studio to JIRA. Once JIRA has been connected, we can see all available JIRA tickets, we can add JIRA ticket search queries, we can automatically update JIRA ticket status, we can see the ticket information such as comments, details and dates, and we can create Git branches based off of the JIRA tickets. Not only does it help JIRA tickets, but you can have different contexts on which to work on. All without ever leaving Android Studio.

NOTE – This can be done in any JetBrains IntelliJ IDE

So how does this work exactly? Well first things first, head over to AS and in the menus up top go to Tools > Tasks & Contexts > Configure Servers… 

Once you click on Configure Servers…  you should see a dialog that looks like this

Click the add button on the lower left hand side, which brings up a list of tools

Select JIRA, you will now see something like this. In the empty fields enter all of your JIRA information.

The server URL can be found in the following format after logging in to JIRA: https://companyname.atlassian.net

If you us your email instead of your username to login, you may not know your username, but you can find it in your profile page. You can also use your email.

and then in your profile page

 

The password is the same one you have always used.

Once you have successfully logged in you should see something similar to this:

Thats it, you are now connected to JIRA. Take a closer look at the Search section. This is where you write the queries of the type of tickets you want to see in Android Studio. You can either see all tickets belonging to everyone, or you can see just your own. I prefer to see only the tickets that are in the ToDo column, and belong to me. Android studio auto generates a default query for you, but i changed mines up a bit so heres what mines looks like

project = "Project Name" AND assignee = jsena AND (resolution = Unresolved OR resolution = "\"Unresolved\"")

One this has been done you will have access to all JIRA tickets that match the search query. You should now see something similar to this in your Android Studio toolbar

Yours would say something like Default instead of develop, but since i normally set my develop branch as my default branch, i renamed it to Develop. When this button is clicked, you will see an option that says “Open Task” Once you click that, you will see a list of all the JIRA tasks/tickets that match the search query from before.

Choose one of the tasks and you will see that you will be prompted with a dialog similar to this

  • The name would be the ticket name
  • The issue state, would be something like In progress, In Review, or In QA
  • The Clear current context section is used to decide if all your currently opened classes, xml files, etc should be closed. I love this feature because every Task is associated with a Context. This means every time you open a task, the tabs you had opened last while you was working on that task will be opened again. So you can be right where you left off.
  • The Create Branch section will display a recommended Git branch name (most likely the name of the JIRA ticket, which is actually good in my case), and the branch you want to branch off of. For example this could be something like JAS-156 (ticket name) from develop – this means create a branch called JAS-156 off of the develop branch.
  • The Use branch section is incase you want to use another already existing branch instead of the new recommended branch name.
  • Last but not least, the changelist is where the explanation/description of the branch would go. This is automatically generated from JIRA by using the tickets description.

Once you click OK, a new branch with, with the branch name specified, will be created and you will automatically be switched to this new branch. You wont have to do git checkout [branchname].

Thats it, for more information on Tasks & Context, you can visit THIS link.

2 Comments

  1. Andi
    04/06/2017

    You deserve a hug man. Thanks

    • josias
      04/06/2017

      haha, you are welcome. Glad you found it helpful!

Comments are closed.