How to review Pull Requests using Android Studio?

André Guedes
5 min readAug 19, 2022

Talking a little about code review process

In general, it is about code developed by someone of the team, and will be available for logic validation, feature requirements, test implementations and even such rule of code conforming to development team, analysis against patterns, etc.

There are some points to discuss about benefits to do code review, like sharing knowledge within developers about the project in fact or the stack, helping on introducing new members or making them go deeper in the project, and others.

You can see in this article more discussion about code review. So, it’s a really good exercise asking developers from your team about benefits that they see doing code review. =)

So, we are going to integrate Android Studio with GitHub now!

Go to your GitHub page, and look for the Settings option, by clicking on your avatar at the top-right of the page.

Setting options located at the end of options menu

On your profile settings page, click on Developer settings, it is the last option at the left side menu.

Developer settings on the profile settings page

OK, and now?

There are two ways to add a GitHub account on Android Studio, by using the GitHub page authorization directly or using a personal access token, which is the mode that I’ll show you how to do now.

Go to the Personal access token option and click in Generate new token button, if you haven’t one yet.

Options to create new access token

As you can see, a note can be added to identify your token or just describe what is it for. The expiration option is required and by default it is selected with a 30 days expiration time. You have an option to create a custom time with a specific date, if it is more convenient.

Define or not a note and select expiration time for your token

We need to select some scopes for this token, that are required to integrate our IDE with GitHub. They are: repo, workflow, read:org, gist. Select them and click in Generate token.

There are more scopes, and you can see here each one and their specifications.

Once a token was created, you will see a message like this talking that you can’t see your token again. So, take care, copy your token to some text note or similar, and save it!!!

Token generated

Let’s go to the Android Studio!!!

Integrating GitHub on Android Studio

Go to the Preferences of Android Studio and then Version Control -> GitHub, to add your account.

GitHub account window

Click in Add account… or '+' button and after that, click in Log In with Token. Paste your token and click in Add Account.

Paste your token

You will see your GitHub account now! Click in Apply and Ok.

GitHub account listed

See you Pull Requests!!!

On the left side of Android Studio IDE, you will see a tool window called Pull Requests, clicking on it you can see all pull requests based on a state, like open, closed, etc. This time I've no open pull requests. =/

When you get a new PR, you will see it on this list, like the next image. You can see all the information about the pull request, like the name, labels, assignees, etc.

By right-click -> View Pull Request or clicking on the right arrow, you will see a new tab with all information about your pull request. Things like files changed, commits, if your PR was reviewed by someone, will be show this moment.

Pull request information

You can start or add comments in lines like GitHub page, submit your review, etc.

Starting review with a comment

I think it is a really good option for developers who like to do all they need using IDE, thinking about productivity, integration and saving time.

So, if you work with GitHub environment I really recommend you to do this integration, work with it and get your conclusions about benefits of using it.

Pros and cons…

‘Things that I liked too much’

We can checkout the branch in a really fast way;
See side-by-side all changes with information like warnings, some code errors, things that we can’t see on the GitHub page for example;
It is so simple for reviewing pull requests that have a few number of files changed, because you can just check it in seconds.

´Things that I see the integration could be better or need a improvement´

We can’t select more than one line to comment, like on the GitHub page experience;
We don’t have a clear feedback about our actions, like a message saying that your comment were add to the PR, for example;
And yes, there are a lot of resources on the web environment that we can’t do on the IDE integration, but why not in the future…?

--

--

André Guedes

Working with mobile app development, with greater focus on the Android platform using Kotlin