We’ll be using IntelliJ IDEA Ultimate for most of our general Java development, as well as for our Android-targeted development. However, like many IDEs, IntelliJ IDEA depends on core components that we must install before we can make much use of the IDE. One of these components is the JDK; another is the Android SDK. With the latter, we’ll install a number of packages that provide additional capabilities for Android development.

Note that as written, this environment preparation step assumes that the JAVA_HOME environment variable refers to either the JDK 11 or the JDK 17 installation, and that the bin subdirectory of the JAVA_HOME-referenced directory is on the PATH. Both of these conditions will be satisfied by a successful installation of JDK 11 or JDK 17.

Important: As is almost always the case in this bootcamp, spelling and casing matter! When creating the directories specified below, please use the names and paths exactly as stated.

Videos

Download and installation

(For those unfamiliar with command line interfaces, it might be useful to read through Command line interfaces before performing the steps below.)

  1. From the Command line tools only section of the Android Studio download page, download the SDK tools package appropriate for your platform.

    Important: Depending on your browser, and a number of other factors, the above link may take you directly to the correct section of the download page—or it may not. Please make sure that you scroll to the section labeled Command line tools only, and click on the link starting with commandlinetools appropriate for your platform.

  2. Extract the contents of the downloaded file to one of the following paths, depending on your platform:

    • Windows: C:\android\sdk\

      Important: There is a subtle problem with the built-in Windows ZIP file support, which affects the most recent versions of this specific download, resulting in the extracted contents of this downloaded file being placed in incorrect directories. Because of this, we’ll use the unzip command included with Git Bash to extract the file contents. To do this, open a Git Bash window, and execute the following commands—which will create the C:\android\sdk directory and unzip the downloaded file to that location. Note that the commands assume you’ve downloaded the commandlinetools-win-7583922_latest.zip file to your Downloads directory; if you’ve downloaded it to another location, you’ll need to adjust the second line below accordingly.

        mkdir -p /c/android/sdk
        unzip ~/Downloads/commandlinetools-win-7583922_latest.zip -d /c/android/sdk/
      
    • OS X: /opt/android/sdk/

      You will need use superuser access—e.g. using the sudo command—to create the directories in Terminal. You can also extract the ZIP file contents from the command line: (Note that the commands assume you’ve downloaded the commandlinetools-mac-7583922_latest.zip file to your Downloads directory; if you’ve downloaded it to another location, you’ll need to adjust the second line below accordingly.)

        sudo mkdir -p /opt/android/sdk
        sudo unzip ~/Downloads/commandlinetools-mac-7583922_latest.zip -d /opt/android/sdk/
      

      Alternatively, you can create the /opt/android/sdk directory from the command line, and then use the standard ZIP-management features of the Finder to extract the ZIP file contents.

    • Linux Ubuntu: /opt/android/sdk/

      You will need use superuser access—e.g. using the sudo command—to create the directories in Terminal. You can also extract the ZIP file contents from the command line: (Note that the commands assume you’ve downloaded the commandlinetools-linux-7583922_latest.zip file to your Downloads directory; if you’ve downloaded it to another location, you’ll need to adjust the second line below accordingly.)

        sudo mkdir -p /opt/android/sdk
        sudo unzip ~/Downloads/commandlinetools-linux-7583922_latest.zip -d /opt/android/sdk/
      

      Alternatively, you can create the /opt/android/sdk directory from the command line, and then use the standard ZIP-management features of the Ubuntu file manager to extract the ZIP file contents.

  3. Download android-sdk-setup.zip, and extract its contents (using the ZIP tool of your choice) to the appropriate directory for your platform:

    • Windows: C:\android\.
    • OS X and Ubuntu: /opt/android/.

    When this step is complete, you will have the following overall structure:

    Windows

    • C:\
      • android\
        • android-sdk-setup.bat
        • android-sdk-setup-osx.sh
        • android-sdk-setup-ubuntu.sh
        • sdk\
          • cmdline-tools\

    Linux or OS X

    • /
      • opt/
        • android/
          • android-sdk-setup.bat
          • android-sdk-setup-osx.sh
          • android-sdk-setup-ubuntu.sh
          • sdk/
            • cmdline-tools/
  4. Run the extracted setup script for your platform:

    • In Windows, open an elevated command prompt, navigate to the C:\android directory, and execute the android-sdk-setup.bat batch file.

    • In OS X, execute sudo /opt/android/android-sdk-setup-osx.sh in a terminal window.

    • In Linux Ubuntu, execute sudo /opt/android/android-sdk-setup-ubuntu.sh in a terminal window.

    Note: These scripts download and extract a large number of files. Depending on the speed of your internet connection, this step could take anywhere from 30 minutes to a few hours. Thus, we strongly recommend that you use the highest-bandwidth connection available (for example, your local Flying Star’s wi-fi is definitely not up to the task).