Install Android Studio on Linux Mint via Terminal: Step-by-Step Guide
Setting up a professional development environment is the critical first step for any Linux Mint developer aiming to build native Android applications. While the graphical interface of Linux Mint provides a familiar and user-friendly experience, leveraging the terminal offers a faster, more transparent, and highly reproducible method for installing Android Studio. This approach not only streamlines the installation process but also provides deeper insight into the configuration required for the Java Development Kit (JDK) and the Android Software Development Kit (SDK) to function harmoniously.
Preparing Your System Environment
Before initiating the installation sequence, it is essential to prepare your Linux Mint system to handle the dependencies and requirements of Android development. The terminal acts as a powerful control center, allowing you to update your package lists and install foundational libraries in one efficient operation. This preparation phase ensures that the graphical installer runs smoothly without encountering missing dependency errors, which can often halt the setup process unexpectedly.
Updating System Packages
Begin by ensuring your system is entirely up to date, which minimizes potential conflicts between new Android Studio components and existing system software. Execute the following commands to refresh your repository index and upgrade all installed packages to their latest stable versions available.
Configuring the Java Runtime
Android Studio relies heavily on a compatible Java Runtime Environment (JRE) or Java Development Kit (JDK) to operate. OpenJDK 17 is the officially recommended version for the latest Android Studio distributions, and installing it via the terminal ensures that the correct paths are established automatically. Without this specific Java version, the studio launcher may fail to initialize the virtual machine required to run the integrated development environment.
- Update package index:
sudo apt update - Upgrade installed packages:
sudo apt upgrade -y - Install OpenJDK 17:
sudo apt install openjdk-17-jdk -y
Once the Java environment is verified and active, you can proceed to acquire the Android Studio package. The most reliable method involves downloading the official command-line tools directly from Google, which provides you with the necessary components to set up a fresh installation. This method bypasses the standard browser download, giving you a clean starting point for the manual configuration of the studio.
Downloading Android Command-Line Tools
To gain precise control over the installation, you will fetch the latest command-line tools from the official Android developer website. Using wget in the terminal allows you to specify the exact URL for the current stable build, ensuring you receive the most recent version without navigating through web interfaces. These tools contain the essential SDK manager and launcher scripts required to build the full integrated development environment.
Installing Unzip Utility
Since the downloaded tools are compressed in a ZIP archive, you must first install the unzip utility to extract the package contents. This step is crucial as the archive contains the critical bin directory, which holds the executable files needed to launch the studio installer. Missing this utility will result in an inability to access the core installation scripts.
- Install unzip:
sudo apt install unzip -y - Download tools:
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O cmdline-tools.zip - Create directory:
mkdir -p ~/android-sdk/cmdline-tools - Extract archive:
unzip cmdline-tools.zip -d ~/android-sdk/cmdline-tools
After successfully extracting the files, you will notice a new directory named cmdline-tools containing a bin folder. Inside this bin folder, you will find the sdkmanager script, which is the primary tool for downloading the necessary Android SDK platforms, build-tools, and system images. To streamline the process and avoid typing the full path every time, you can move the launcher script to a location included in your system's PATH.
Setting Up the SDK Manager
Moving the cmdline-tools directory to a standard location ensures that the terminal can locate the Android SDK tools regardless of your current working directory. This organizational step is not strictly mandatory but is highly recommended for maintaining a clean system structure and preventing path resolution errors during future updates.
- Move tools to bin:
sudo mv ~/android-sdk/cmdline-tools/cmdline-tools ~/android-sdk/cmdline-tools/latest - Create symlink:
sudo ln -s ~/android-sdk/cmdline-tools/latest/bin/sdkmanager /usr/local/bin/sdkmanager
With the SDK manager now globally accessible, you can accept the necessary licenses and install the core components of the Android SDK. This action downloads the required platform tools, the latest build-tools, and the essential Android API levels. Accepting the licenses upfront prevents interactive prompts during the studio installation, allowing the process to run seamlessly in the background.
Finalizing the Android Studio Installation
With the command-line tools configured and the SDK components installed, you are now ready to download the Android Studio package itself. Using the terminal to fetch the tar.gz archive ensures you obtain the exact version intended for Linux systems, complete with all native dependencies pre-configured. Extracting this archive and creating a symbolic link provides a consistent entry point for launching the application, regardless of future updates.
- Download studio:
wget https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2023.1.1.24/android-studio-ide-241.12260126-linux.tar.gz -O android-studio.zip - Create opt directory:
sudo mkdir -p /opt/android-studio - Extract studio:
sudo tar -xzf android-studio.zip -C /opt/android-studio --strip-components=1 - Create desktop entry:
sudo ln -s /opt/android-studio/bin/studio.sh /usr/local/bin/android-studio
You have now completed the installation using the terminal, and Android Studio is ready to be launched. You can start the application by typing android-studio directly into the terminal, which initializes the graphical interface and presents the setup wizard. This wizard guides you through selecting the installation type, whether you prefer the standard setup for default configurations or the custom setup to tailor the SDK location and visual theme to your specific preferences.
Verifying the Development Environment
After the initial configuration wizard completes, it is prudent to verify that the Android Virtual Device (AVD) and emulator are functioning correctly within your new environment. A properly configured emulator allows you to test applications on virtual devices that mimic the behavior of physical hardware, ensuring your code runs as expected. The terminal provides the commands to list available system images and create a virtual device with specific hardware properties, giving you full control over the testing landscape.
- List available system images:
sdkmanager --list | grep -i "system images" - Install a system image (e.g., ARM 64 v8A):
sdkmanager "system-images;android-34;google_apis;x86_64" - Create an AVD:
avdmanager create avd -n test_avd -k "system-images;android-34;google_apis;x86_64"
Finally, to ensure that the entire toolchain is correctly integrated, you can verify the installation of the SDK components and the studio launcher. This verification step confirms that the environment variables are set correctly and that the terminal can communicate with every layer of the development stack. By following these precise terminal commands, you have established a robust, efficient, and professional Android development environment on Linux Mint, entirely through the power of the command line.