Image credit: JetBrains

IntelliJ Java & Android Setup

How to configure IntelliJ for Java and Android projects

Image credit: JetBrains

IntelliJ Java & Android Setup

How to configure IntelliJ for Java and Android projects

My Java toolchain doesn’t change that often; typically just to upgrade to newer versions, or add a plugin that I find interesting. I’ve written before about my favorite Java tools to use in-class. In this post, I’ll demonstrate a step-by-step walkthrough to install IntelliJ, which I use for larger projects. This configuration should also work well for CS 349 assignments!

Once completed, these steps should enable you to build and run Java and Android apps on your machine.

1. Install Homebrew & Java

Homebrew is a comprehensive package manager that you can use to install and update almost any software package on a Mac. I use it to maintain most of my build tools. You can install it from here. Once it’s installed, we can use it to install some basics.


$ brew install git
$ brew install java

2. Install IntelliJ

Grab the latest version of [IntelliJ Community from the JetBrains site](https://www.jetbrains.com/idea/download/). The Commuity Edition supports standard Java and Android applications, and is fine for most purposes.

JetBrains also offers a free license for most of their development tools for students and faculty, which support additional languages like Python and Javascript.

Install using whatever method is appropriate for your platform.

3. Configure Java

You need to set some options in IntelliJ so that it uses the correct version of Java (i.e. it may default to an older system version instead of the shiny new version you installed earlier, and we need to fix that).

  1. Launch IntelliJ.
  2. From the “Open Project” dialog, click on the Configure button, then “Project Defaults”, “Project Structure”.
  • Click on SDKs in the left panel, and make sure that your version of Java is listed (if not, click + and add it).
  • Click on Project, and make sure that your Project SDK matches the Java SDK that you have configured.
  • Click on OK to save and exit.

4. Install Plugins

Out-of-the-box, InstallJ will build desktop apps, but we need to add Android support.

  1. Launch IntelliJ.
  2. From the “Open Project” dialog, click on the IntelliJ Menu, and choose “Preferences”. Navigate to plugins, and you should see a list something like this (it will vary by platform/version).

Make sure to check at least the following plugins, and click OK.

  • Android Support
  • Git Integration
  • Gradle (required for building apps)

That’s it! There’s other options to setup, but they’re project specific. Generally, IntelliJ should work find now if you use the New-Project wizard, and set the appropriate options when you setup your project.

Avatar
Jeff Avery
Lecturer, Cheriton School of Computer Science

Related