Kotlin
Java

MP: Android Studio Setup

To complete the CS 124 machine project (MP) you'll write your code using Android Studio. You'll test your app using the Android Emulator—and on a real device, if you have one. This guide will help you install and configure these tools.

Android Studio

Android Studio is the integrated development environment (IDE) for Android development. To install it, follow the instructions below that are appropriate for your machine.

Keep in mind that installing new software can be challenging, so don't be discouraged if you get stuck. We're here to help! Jump on the help site, or ask for help on the forum.

Version

For Fall 2021 we are using Android Studio version 2020.3.1 "Arctic Fox", which is the latest available as of October 2021. Please install this version of Android Studio and continue using it throughout the semester.

If an upgrade is released, the course staff will let you know if it is safe to use. Please don't upgrade until you get the OK from us, since even minor upgrades may affect your ability to work on the machine project.

Installation

Begin by downloading the version of Android Studio appropriate for your machine using this link. Next, follow these instructions carefully.

Android Studio Plugins

Continue by installing several plugins. Which depends on whether you are using Java or Kotlin, although it is also safe to install all of them!

Java

If you are developing in Java, install the following plugins:

  1. the checkstyle IntelliJ plugin
  2. the official CS 124 plugin

We will continue to use checkstyle to help you learn how to write beautiful and maintainable Java code by requiring you to adhere to a coding standard. There are checkstyle points on each Java MP checkpoint, so you want to get the plugin installed so that you can check your style as you go.

Installing these plugins is straightforward:

  1. Open the Android Studio plugins menu
  2. Open the "Marketplace" menu
  3. Search for "checkstyle" and install the "Checkstyle-IDEA" plugin that appears
  4. Search for "CS 124" and install the plugin that appears
  5. Restart Android Studio to complete the installation

You should install the latest version of the checkstyle plugin, currently 5.56.0, and the CS 124 plugin, currently 2021.9.1.203. Plugin updates that are released during the semester should be safe to install.

Kotlin

If you are developing in Kotlin, install the following plugins:

  1. the detekt IntelliJ plugin
  2. the official CS 124 plugin

We will use detekt to help you learn how to write beautiful and maintainable Kotlin code by requiring you to adhere to a coding standard. There are detekt points on each Kotlin MP checkpoint, so you want to get the plugin installed so that you can check your style as you go.

Installing these plugins is straightforward:

  1. Open the Android Studio plugins menu
  2. Open the "Marketplace" menu
  3. Search for "detekt" and install the plugin that appears
  4. Search for "CS 124" and install the plugin that appears
  5. Restart Android Studio to complete the installation

You should install the latest version of the detekt plugin, currently 1.18.1, and the CS 124 plugin, currently 2021.9.1.203. Plugin updates that are released during the semester should be safe to install.

Install SDK 30

The 2021–2022 CS 124 MP uses the Android SDK version 30. You should install this using the Android SDK Manager.

Android Emulator

An important part of Android development is to be able to test your work. If you have an Android device, you can configure Android Studio to install your test app onto it. However, if you don't have an Android device, or want to test on devices other than ones that you own, you'll need to utilize the Android Emulator.

The easiest way to get a virtual device set up is to start a project, build it, and then try to run it. That will launch a dialog allowing you to configure a virtual device. Going through the Android "Hello, World!" is also a great way to get started familiarizing yourself with app development. But you can also start with our machine project starter code.

Installing Git

Before you can use Git with Android Studio you may need to install the underlying Git tool itself. We suggest you start here to install Git. Once you complete the installation, Android Studio should automatically detect Git and allow you to use it to manage your Android projects.

Note that you do not need to install or use a GUI for Git or the GitHub Desktop application. We're going to use Android Studio's excellent built-in Git interface. So once you've installed Git you can move on.

Running on Real Devices

If you have an Android phone you can also install and run your apps on your own device, which will be faster and more fun that using the emulator. Follow this tutorial for instructions on how to configure your device properly to run your apps during development.