Development of mobile applications for the Android platform requires specialized tools, and Android Studio is the official industry standard. For users of Linux operating systems such as Ubuntu, Fedora or Debian, the installation process may seem more complex compared to Windows or macOS, but it opens up access to powerful command line tools and high system performance.
In this article, we will examine in detail all the stages of preparing the development environment: from checking system requirements and installation Java Development Kit (JDK) to the final configuration of the emulator. Proper workspace configuration is critical for stable operation of the Gradle compiler and fast rendering of interfaces in real time.
Before you start downloading distributions, you need to make sure that your system meets the minimum requirements. Insufficient RAM or lack of hardware virtualization can cause the IDE to run incorrectly or be excessively slow. Pay attention to preparing the system in advance.
Preparing the system and installing dependencies
The first step is updating the repositories and installing the necessary libraries, without which the integrated development environment will not be able to correctly display the graphical interface or work with the network. On most Debian or Ubuntu-based distributions, this is done through a terminal with superuser rights.
You will need to install packages to support 32-bit libraries (even on 64-bit systems), as some components of the Android SDK still depend on them. You also need to make sure that you have utilities for working with archives and network requests.
sudo apt update
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 unzip wget
After installing the basic dependencies, you should check the status of hardware virtualization. To run the Android emulator (AVD), the processor must support VT-x (Intel) or AMD-V technologies. You can verify this using the utility egrepby running the command in the terminal.
โ ๏ธ Attention: If the command output shows an empty result, virtualization is disabled in the BIOS/UEFI. You need to restart your computer, go into the BIOS settings and activate the appropriate option, otherwise the emulator will not start.
The next critical component is JDK (Java Development Kit). Although modern versions of Android Studio come with JetBrains Runtime built-in, it is still recommended to have system JDK version 11 or 17 installed for many plugins and build tools to work. 32-bit libraries
โ๏ธ System readiness check
Downloading and unpacking the distribution
Official The developer's website offers several download options, but for Linux the most preferable is the archive format .tar.gzcontaining the full version of the IDE. Avoid using versions from third-party repositories (such as Snap or Flatpak) if you need full control over the file structure and plugins.
The downloaded archive must be unpacked into a directory to which your user has write permissions, but which is also executable. The standard installation location in a Linux environment is the directory /opt or the user's home directory.
- ๐ Go to the downloads folder:
cd ~/Downloads - ๐ฆ Unpack the archive:
tar -xzf android-studio-*.tar.gz - ๐ Move the folder:
sudo mv android-studio /opt/
After moving the files, it is recommended to change the owner of the directory to the current user to avoid problems with access rights when updating plugins or creating projects. This is done using the command chown, specifying your username and group.
Use the `whoami` command in the terminal to find out exactly what your username is if you are not sure of it. This name must be substituted into the chown command.
Setting environment variables and paths
In order to run Android SDK command line tools from anywhere in the terminal, you need to set the paths to executable files in system environment variables. This applies to utilities such as adb (Android Debug Bridge) and fastboot.
Open a shell configuration file (for example .bashrc or .zshrc in your home directory) and add export variables. This will allow the system to find the required binaries without specifying the full path to them each time the command is run.
export ANDROID_HOME=$HOME/Android/Sdkexport PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
After making changes to the configuration file, you need to apply them by running the command source ~/.bashrc (or the appropriate file for your shell). You can check the success of the setup by entering the command adb version in a new terminal window.
| Variable | Default value | Destination |
|---|---|---|
| ANDROID_HOME | ~/Android/Sdk | SDK root folder |
| platform-tools | inside the SDK | Debugging utilities (ADB) |
| emulator | inside the SDK | Running virtual devices |
| tools/bin | inside the SDK | Management tools SDK |
โ ๏ธ Attention: If you are using the Zsh shell (standard in Ubuntu 24.04 and later), edit the
~/.zshrcfile, not the .bashrc. Otherwise, the variables will not be applied after the terminal is rebooted.
First launch and setup wizard
You can launch the development environment directly from the installation directory by executing the script studio.shlocated in the folder bin. When you launch it for the first time, a setup wizard will open, which will offer you to import previous settings or configure the environment from scratch.
At the stage of selecting the installation type, it is recommended to select Standardunless you are an experienced user who wants to manually control each component. The system will automatically download the latest versions of the SDK platforms, build tools and emulator.
During the installation process, the wizard will ask you to confirm the license for the Android SDK components. You must carefully read the terms (or quickly scroll through them) and select the option to accept all license agreements, otherwise downloading components will be blocked.
What to do if the wizard is stuck on the download?
Sometimes the built-in bootloader can be unstable due to proxy or network problems. In this case, you can interrupt the installation, download the SDK Manager separately and install the components manually via the command line.
Setting up the emulator and working with devices
One โโof the main features of developing for Android is the ability to test applications on virtual devices. In Linux, to speed up the emulator, it is critical to use hardware acceleration via KVM (Kernel-based Virtual Machine).
Check whether the KVM kernel module is loaded using the command lsmod | grep kvm. If the module is not active, load it with the command sudo modprobe kvm_intel (for Intel processors) or kvm_amd (for AMD). Without this, the emulator will work in software emulation mode, which is extremely slow.
- ๐ Open Device Manager in Android Studio.
- โ Click "Create Device" and select the model (for example, Pixel 6).
- ๐พ Select the system image (System Image) marked "Play Store" or "Google APIs".
- โ๏ธ In the emulator settings, make sure that the use of GPU Host is enabled.
When creating a virtual device, pay attention to allocating RAM. You should not allocate more than 50% of the total RAM of your system, otherwise the host operating system will begin to actively use the swap file, which will lead to general slowdowns.
โ ๏ธ Attention: If the error "KVM is not installed" occurs when starting the emulator, check the access rights to the device
/dev/kvm. Your user may need to add rights via the command sudo usermod -aG kvm $USER.
Using KVM in Linux provides emulator performance close to working on a real physical device, as opposed to software emulation.
Frequent problems and their solutions
During operation, developers often encounter with problems of lack of rights to connect physical devices via USB. In Linux, unlike Windows, access to USB ports for unprivileged users is limited by rules udev.
To solve this problem, you need to create a rules file in the directory /etc/udev/rules.d/, for example 51-android.rules, and write a rule in it that allows access to devices with specific VIDs (Vendor ID). After creating the file, you need to restart the udev service.
SUBSYSTEM=="usb", ATTR{idVendor}=="****", MODE="0666", GROUP="plugdev"
Another common problem is lack of disk space. Android projects, especially those with included libraries and Gradle cache, can occupy tens of gigabytes. Regularly clear the cache through the menu File โ Invalidate Caches and monitor the free space in the system root.
If you encounter compilation errors related to Java versions, check the environment variable JAVA_HOME. It should point to the path to an installed JDK that is compatible with the version of Gradle used in your project.
Why does Gradle download files every time?
Gradle stores dependencies in the local ~/.gradle cache. If you cleared this cache or changed the user, the download will repeat. Don't delete the .gradle folder unnecessarily.
Optimizing IDE performance
Android Studio is written in Java and consumes a significant amount of resources. By default, the allocated amount of memory may be insufficient for large projects, which leads to frequent garbage collections (Garbage Collection) and interface freezes.
To increase performance, edit the file studio.vmoptions, which is located in the installation directory or in the user configuration folder. Increase the parameters -Xms (initial heap size) and -Xmx (maximum heap size) according to the amount of your RAM.
- ๐ง Set
-Xms512mfor a quick start. - ๐ Install
-Xmx2048mor-Xmx4096mfor heavy projects. - โก Enable "Power Save Mode" in the File menu if you just need to read the code without background indexing.
It is also recommended to disable unnecessary plugins, which are supplied by default. If you do not develop for Google Cloud or do not use specific testing tools, disabling them will free up system resources and speed up the launch of the IDE.
How to completely remove Android Studio from Linux?
To completely remove it, you need to delete the installation directory (usually /opt/android-studio), configuration folder (~/.AndroidStudio*), SDK folder (~/.android and ~/Android/Sdk) and Gradle cache (~/.gradle). Also, don't forget to remove the created udev rules and environment variables from the shell configuration file.
Is it possible to install Android Studio via Snap?
Yes, the command `sudo snap install android-studio --classic` works, but this version works in a sandbox environment. This can cause problems with accessing physical devices via USB and accessing files outside the home directory without additional configuration.
Why does the emulator not see the network?
In Linux, the emulator uses a virtual network interface. If you have a strict firewall configured (iptables/ufw), it may block the connection. Try temporarily disabling the firewall to check or add a rule that allows traffic for the qemu-system-x86_64 process.
Which version of Linux is best suited?
The most stable operation is observed on distributions with kernel version 5.10 and higher, such as Ubuntu 22.04/24.04, Fedora Workstation or Manjaro. It is important to have the latest video card drivers (especially for NVIDIA) for correct operation of the emulator interface rendering.
Do you need a separate JDK for new versions of Studio?
Starting with versions 2020+, Android Studio by default uses the built-in JetBrains Runtime based on OpenJDK. Installing the system JDK is not strictly required to run the IDE, but is desirable for the operation of some third-party plugins and console utilities.