Skip to content

Setting Up Your Development Environment

You’ll need Java installed on your system to run Gradle, the build tool we’ll be using to compile and package our app. I recommend Java 21 since it’s compatible with a very wide range of Gradle versions, including the most recent ones.

When you open a terminal and type java -version, you should see something like this:

openjdk version "21.0.2" 2024-01-16
OpenJDK Runtime Environment (build 21.0.2+13-58)
OpenJDK 64-Bit Server VM (build 21.0.2+13-58, mixed mode, sharing)

(Look for “21” here. OpenJDK is just the distribution of Java that I’m using, and it’s fine if yours is different.)

Google makes an IDE called Android Studio based on IntelliJ IDEA. It’s the industry standard for Android development, and it comes with tons of Android-exclusive features. Download it here.

From the home screen, click New Project. Select Empty Activity, then Finish.

The IDE may take a few minutes to become responsive at this point. This is because it’s downloading the project’s dependencies and building an index for features like jump-to-definition and type-aware inspections.

If you don’t have an Android phone, you’ll need an Android emulator to test out your app.

  1. Open up Android Studio.
  2. Open the Device Manager panel in the right-hand dock
  3. Click “Add a new device” > “Create virtual device”.
  4. Select any screen size and click Next.
  5. Make sure the System Image is a modern Android version, and click Finish.
  6. If you don’t already have the system image downloaded, the IDE will prompt you to download it. Click Yes.

When the download is complete, you can start up your emulator in the Device Manager panel. Click the play button next to any of your virtual devices.

The Device Manager panel also allows you to connect Android Studio to real Android devices.

First, you’ll need to enable developer options, and then either USB or Wi-Fi Debugging.

  1. Open the Settings app on your phone.
  2. Navigate to “About phone”.
  3. Scroll all the way down. Tap on the build number 7 times.
  4. Enter your device’s PIN or password.
  5. You should see a message that says “You are now a developer!”

Now, enable debugging:

  1. Open the Settings app on your phone.
  2. Navigate to “Developer options” > “Debugging”.
  3. Enable either USB debugging or Wireless debugging.

To use USB debugging, plug your phone in to your computer with a USB type-C cable. Note that the cable needs to support data transfer, not just charging.

To use wireless debugging, open Android Studio to the Device Manager panel. Click “Pair Devices Using Wi-Fi”, and select your device from the list. Your phone and computer need to be on the same Wi-Fi network for this to work. Then, scan the QR code from your phone, and your device should be connected.

If wireless debugging doesn’t work, it may be because of security restrictions from the Wi-Fi network operator. In that case, you can try using Tailscale to create a VPN containing both of your devices.

Note that some apps on your phone, especially banking apps, may not function while you have debugging enabled. You can always disable it from the same place you enabled it, or by disabling the “Use developer options” toggle under Developer Options in your device settings.

At this point, you should have a virtual or physical device in the Device Manager. Near the top of the screen, you should see your run/debug configurations:

Click the run button. If you’re using an emulator, it should start up.

Android Studio will build the app, install it on the device, and run it.

You should see something like this: