Dan Tech Academy
After this lesson you will
  • Install Git and set your commit identity with user.name and user.email
  • Install JDK 17 and understand why the Gradle toolchain needs exactly this version
  • Install a stable Android Studio, check the SDK components and get an emulator or a real phone ready
Duration10 min
DifficultyBeginner

Install Git, JDK 17, Android Studio And The SDK

Set up Git, JDK 17 and the Android tooling you need to clone, open and build the course's Kotlin Multiplatform app.

Video in production

Lesson video is on the way

While you wait, read the full text version below: complete theory, code samples and the hands-on checklist.

Recording is in post-production

Lesson Goal

By the end of this lesson your machine has the three things it needs to clone, open and build the course's Kotlin Multiplatform (KMP) project:

  • Git to work with the repository,
  • JDK 17 so Gradle can compile the code,
  • Android Studio with the Android SDK to open, build and run the Android app.

The iOS side also needs macOS and Xcode, and it is optional. On Windows and Linux you can still take the whole course on Android.

Before You Install Anything

When I set up a new machine, I don't clone the project right away. I check the toolchain first, because most "the project won't build" errors in the first week are really environment errors. A few extra minutes now save you hours of debugging later.

Part 1: Install Git

Git is a tool that runs on your machine. You use it to clone repos, see changes and commit. GitHub and GitLab are services that host repositories. Git is what lets your machine work with them.

Official page: Git official install page.

Step 1: Download Git From The Official Page

OSRecommended install
macOSUse the macOS option on the official page, or Homebrew with brew install git if you already use Homebrew
WindowsPick Windows on the official page and keep Git Bash enabled during the install
Ubuntu/DebianRun sudo apt update && sudo apt install git
FedoraRun sudo dnf install git

Step 2: Open A New Terminal

After the install, close the old terminal and open a new one. The old terminal hasn't picked up the new PATH. Run:

bash
git --version

The terminal should print a Git version. If it says command not found or 'git' is not recognized, either Git didn't finish installing or the terminal hasn't picked up the PATH. Restart the machine and try again.

Step 3: Configure Your Git Identity

You only need to do this once after installing Git:

bash
git config --global user.name "Your Name"
git config --global user.email "[EMAIL_ADDRESS]"

user.name and user.email are the author details recorded on every commit. This command does not log you in to GitHub.

Check it:

bash
git config --global user.name
git config --global user.email

Part 2: Install JDK 17

The project uses a Gradle toolchain: every KMP module declares jvmToolchain(17) in the KmpLibraryConventionPlugin convention plugin (in the build-logic/ folder). Gradle looks for a JDK 17 already installed on your machine to compile with. The repo doesn't configure automatic JDK downloads, so if your machine has no JDK 17, the build stops with:

text
Cannot find a Java installation on your machine ... matching: {languageVersion=17, ...}
Toolchain download repositories have not been configured.

You still get this error if you already have JDK 21. The toolchain needs exactly version 17. The JDK bundled with Android Studio (the jbr folder) won't do either, because recent Android Studio releases ship JDK 21.

Install a JDK 17, for example Eclipse Temurin 17:

OSHow to install
macOSbrew install --cask temurin@17, or download the .pkg from Adoptium
WindowsDownload the .msi from Adoptium and install with the defaults
Ubuntu/Debiansudo apt install openjdk-17-jdk
Other LinuxInstall your distro's OpenJDK 17 package, or Temurin 17 from the Adoptium site

These installs put the JDK in the operating system's standard location, where Gradle finds it on its own. More on this: Gradle toolchains.

Open a new terminal and check:

bash
java -version

If you have several JDKs, java -version may print something other than 17. That's fine as long as JDK 17 is installed. To keep ./gradlew commands stable, point JAVA_HOME at JDK 17. On macOS:

bash
echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 17)' >> ~/.zshrc

Part 3: Install Android Studio And The Android SDK

Android Studio is Google's official IDE for Android. It includes the Android SDK, the emulator, device tools, Gradle integration and the code editor. It also opens and edits KMP code (commonMain, androidMain, iosMain).

Use the latest stable release. The repo uses Android Gradle Plugin 9, so an Android Studio that is too old won't sync.

Step 1: Download The Stable Installer

Get the installer from the Android Studio download page, not from an unofficial site. If the page shows a preview or canary build, skip it. Install with your operating system's default steps.

Step 2: Let The Setup Wizard Install The SDK

The first time you open Android Studio, choose the standard setup so the wizard installs the standard SDK components:

  • Android SDK Platform
  • Android SDK Build-Tools
  • Android SDK Platform-Tools
  • Android SDK Command-line Tools
  • Android Emulator, if you use an emulator

Step 3: Check The SDK Manager

  1. Go to Settings (macOS: Preferences).
  2. Open Languages & Frameworks > Android SDK.
  3. Confirm an Android SDK location is set.
  4. SDK Platforms tab: install a recent stable Android platform if none is there.
  5. SDK Tools tab: install Build-Tools, Platform-Tools, Command-line Tools, and the Emulator if you need it.

Once you have accepted the licenses, Gradle downloads the exact SDK platform the project needs during the first build.

Step 4: Get Somewhere To Run The App

You need at least one place to run the Android app:

  • Emulator: open Device Manager in Android Studio and create a virtual device. See Create and manage virtual devices.
  • A real Android phone: turn on Developer options, turn on USB debugging, plug in the cable and accept the debugging prompt on the phone. See Run apps on a hardware device. The app needs Android 8.0 (API 26) or newer.

With a real phone, adb devices must list your device with the state device.

Check Everything In The Terminal

bash
git --version
git config --global user.email
java -version
adb version

If adb isn't found, check that Platform-Tools is installed in the SDK Manager. Android Studio installs adb into the Android SDK's platform-tools folder but doesn't add that folder to PATH for you:

OSAdd platform-tools to PATH
macOSecho 'export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools"' >> ~/.zshrc
Linuxecho 'export PATH="$PATH:$HOME/Android/Sdk/platform-tools"' >> ~/.bashrc
WindowsOpen Edit environment variables for your account, choose Path > Edit > New, paste %LOCALAPPDATA%\Android\Sdk\platform-tools

These are the default SDK paths. If the SDK Manager shows a different path, use that one, then open a new terminal and run adb version again.

On Windows, open Git Bash once. It gives you a more reliable shell for the course commands.

You don't need to run ./gradlew yet, because you haven't cloned the repo.

Troubleshooting Table

Troubleshooting infographic for Git, Android Studio and Android SDK setup: check git, adb, the SDK, the emulator, licenses and the first sync.
ErrorCheck first
Cannot find a Java installation ... languageVersion=17Install JDK 17 as in Part 2, then open a new terminal or IDE
java is not on PATHInstall JDK 17 and set JAVA_HOME
adb is not on PATHAdd platform-tools to PATH

Checkpoint

Save the output of these commands so you can compare when a build fails:

bash
git --version
git config --global user.email
java -version
adb version
Sign in