How to configure IntelliJ for Android
April 15, 2018
My Java toolchain doesn’t change that often; typically just to upgrade to newer versions, or add a plugin that I find interesting. 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.
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.
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).
- Launch IntelliJ.
- 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.
- Launch IntelliJ.
- 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.