Sahil Verma
Posted on June 30, 2024
Android development on Linux is straightforward and provides a powerful platform for app creation. This guide will walk you through installing Android Studio, Java Development Kit (JDK), and setting up necessary environment variables.
1. Installing Android Studio
Android Studio is the official Integrated Development Environment (IDE) for Android app development. Here's how to install it on Linux:
a) Update your package lists:
sudo apt update
b) Install required dependencies:
sudo apt install default-jdk libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
c) Download Android Studio:
wget https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2023.1.1.26/android-studio-2023.1.1.26-linux.tar.gz
d) Extract the downloaded archive:
sudo tar -xvzf android-studio-*.tar.gz -C /opt/
e) Create a desktop entry for easy access:
echo "[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Exec="/opt/android-studio/bin/studio.sh" %f
Icon=/opt/android-studio/bin/studio.svg
Categories=Development;IDE;
Terminal=false
StartupNotify=true
StartupWMClass=android-studio" | sudo tee /usr/share/applications/android-studio.desktop
f) Make the desktop entry executable:
sudo chmod +x /usr/share/applications/android-studio.desktop
g) Launch Android Studio:
/opt/android-studio/bin/studio.sh
2. Installing Java Development Kit (JDK)
JDK is a crucial component for Android development. Here's how to install it:
a) Update package lists:
sudo apt update
b) Install default JDK:
sudo apt install default-jdk
c) Verify the installation:
java -version
javac -version
3. Setting Environment Variables
Setting ANDROID_HOME and JAVA_HOME is important for smooth Android development:
a) Find your Java installation path:
update-alternatives --display java
b) Edit your .bashrc file:
nano ~/.bashrc # with nano
code ~/.bashrc # with vs code
c) Add these lines at the end of the file:
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 # Check for installed version
export PATH=$PATH:$JAVA_HOME/bin
export ANDROID_HOME=/opt/android-studio/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
d) Save and close the file.
e) Apply the changes:
source ~/.bashrc
f) Verify the settings:
echo $JAVA_HOME
echo $ANDROID_HOME
With these steps completed, you'll have a fully functional Android development environment on your Linux system. Remember to keep your tools updated and explore the vast world of Android app development!
Posted on June 30, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.