To complete the CS 124 machine project (MP) you’ll write 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 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 tutoring site, ask for support on the forum, or come in for help during our Tuesday in-person tutoring sessions.
You will need a laptop or other personal computer to work on the MP. Most laptops are able to run Android Studio without too much trouble, although the emulator may be slow on older models.
If you don’t have access to a laptop or personal computer, you’ll need to explore laptop loaner programs offered by the university. There are several. If you get really stuck, please reach out to the course staff for help.
For Fall 2024 we are using Android Studio version 2024.2.1 Patch 1 “Ladybug”, which is the latest available as of October 2024. 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.
Begin by downloading the version of Android Studio appropriate for your machine using this link. Next, follow these instructions carefully.
Continue by installing several plugins. Which depends on whether you are using Java or Kotlin, although it’s safe to install all of them!
If you are developing in Java, install the following plugins:
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:
You should install the latest version of the checkstyle
plugin, currently 5.96.0
, and the CS 124 plugin, currently 2024.10.0.231
.
Plugin updates that are released during the semester should be safe to install.
If you are developing in Kotlin, install the following plugins:
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:
You should install the latest version of the detekt
plugin, currently 2.4.2
, and the CS 124 plugin, currently 2024.10.0.231
.
Plugin updates that are released during the semester should be safe to install.
The 2024–2025 CS 124 MP uses the Android SDK version 34. As of October 2024, this is not the latest Android SDK available. So you will need to install it manually using the SDK manager. Here’s a quick overview of how to do that:
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. Here’s a walkthrough of how to configure and run an Android virtual device using the emulator:
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.
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 these instructions on how to configure your device properly to run your apps during development.
Android Studio can be a finicky beast.
Sometimes it can get into states where something that should be working isn’t.
For example, an import
that should be available shows up as highlighted in red and unavailable.
I’ve encountered a wide range of strange errors when using this tool over the years.
Here’s a few steps that sometimes work that we’d suggest taking before you ask for support:
If none of these work, please seek help from a course tutor. At times completely uninstalling Android Studio and reinstalling is also successful, but that’s a slow process and not something you should try before at least talking to a tutor.
Gradle is the build system used to build Android projects. It’s responsible for downloading required dependencies, building the app, and running tests.
At times, Gradle’s internal data can get corrupted, and you may need to remove the directory where it stores data locally to allow it to recover. The following video shows how to identify the Gradle home directory, ensure that it is properly located, and remove it if necessary.