dotlinux blog

Beginner’s Guide to Android Studio and Kotlin Setup on Ubuntu 24.04

Android development has become increasingly popular, and with the power of Android Studio and the simplicity of Kotlin, creating amazing Android applications is within reach. In this guide, we'll walk you through the process of setting up Android Studio and Kotlin on Ubuntu 24.04, step by step. Whether you're a complete beginner or have some programming experience, this guide will help you get started on your Android development journey.

2026-03

Table of Contents#

  1. Prerequisites
  2. Installing Java Development Kit (JDK)
  3. Downloading Android Studio
  4. Installing Android Studio
  5. Setting up Kotlin
  6. Creating Your First Android Project
  7. Running Your Android Project
  8. Troubleshooting Common Issues
  9. Conclusion
  10. References

Prerequisites#

Before we begin, make sure your Ubuntu 24.04 system meets the following requirements:

  • At least 8GB of RAM (16GB recommended for better performance)
  • A decent amount of free disk space (around 10GB or more)
  • A stable internet connection

Installing Java Development Kit (JDK)#

Android Studio requires the Java Development Kit (JDK) to be installed on your system. Follow these steps to install the JDK:

  1. Open the terminal by pressing Ctrl + Alt + T.
  2. Update the package lists:
sudo apt update
  1. Install the OpenJDK 11 (which is compatible with Android Studio):
sudo apt install openjdk-11-jdk
  1. Verify the installation by checking the Java version:
java -version

You should see output similar to:

openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment (build 11.0.19+7-Ubuntu-0ubuntu124.04)
OpenJDK 64-Bit Server VM (build 11.0.19+7-Ubuntu-0ubuntu124.04, mixed mode, sharing)

Downloading Android Studio#

  1. Go to the official Android Studio website: https://developer.android.com/studio
  2. Scroll down and click on the "Download Android Studio" button.
  3. Select the Linux (64-bit) option. The download will start as a .bin file.

Installing Android Studio#

  1. Open the terminal and navigate to the directory where the downloaded Android Studio .bin file is located (usually the Downloads directory).
cd Downloads
  1. Make the .bin file executable:
chmod +x android-studio-ide-*.bin

(Replace * with the actual version number in the file name) 3. Run the installer:

./android-studio-ide-*.bin
  1. Follow the on-screen instructions in the Android Studio Setup Wizard. You'll be able to choose the installation location, select components (it's recommended to keep the default selections for now), and configure other settings.

Setting up Kotlin#

Android Studio comes with Kotlin support out of the box. But to confirm and enable it (if for some reason it's not already set up):

  1. Open Android Studio.
  2. Go to File -> Settings (on Linux, it might be Android Studio -> Preferences).
  3. In the left sidebar, expand Languages & Frameworks and select Kotlin.
  4. If Kotlin is not installed, you'll see an option to install it. Click on the relevant button (usually something like "Install" or "Enable") and follow the prompts.

Creating Your First Android Project#

  1. In Android Studio, click on Start a new Android Studio project.
  2. In the Create New Project window:
    • Select an activity template (for example, "Empty Activity" is a good starting point for a simple app).
    • Give your project a name (e.g., "MyFirstApp").
    • Set the package name (usually follows a reverse domain name style like com.example.myfirstapp).
    • Choose the location where you want to save the project.
    • Select the minimum SDK version (you can start with a relatively recent one like Android 6.0 (Marshmallow) or higher).
    • Make sure the language is set to Kotlin.
  3. Click Finish. Android Studio will now create the basic structure of your Android project with Kotlin code.

Running Your Android Project#

  1. Connect an Android device to your computer via USB (make sure USB debugging is enabled on the device. You can usually find this option in Settings -> System -> Developer options).
    • If you don't have a physical device, you can create an Android Virtual Device (AVD):
      • Go to Tools -> Device Manager.
      • Click on Create device.
      • Select a device configuration (e.g., a Pixel phone) and an Android image (like the latest Android version available).
      • Follow the steps to create the AVD.
  2. In Android Studio, click on the green "Run" button (the triangle icon) or use the shortcut Shift + F10.
  3. Select the device (either the physical one or the AVD) that you want to run the app on.
  4. Android Studio will build the app and install it on the selected device. You should see your app launch on the device.

Troubleshooting Common Issues#

  • Java Version Mismatch: If you get an error related to the Java version, make sure you have installed the correct JDK (OpenJDK 11 as mentioned earlier) and that Android Studio is configured to use it. You can check the JDK path in File -> Project Structure -> SDK Location (under Project Settings).
  • Slow Performance: If Android Studio is running slowly, you can try increasing the amount of memory allocated to it. Go to Help -> Edit Custom VM Options and adjust the -Xmx value (e.g., from 2048m to 4096m if you have enough RAM).
  • Build Errors: If there are build errors in your Kotlin code, carefully check the error messages in the Build window. Common issues include syntax errors (like missing semicolons in Kotlin, although Kotlin is more lenient than Java in some cases), incorrect imports, or problems with resource files.

Conclusion#

Congratulations! You've successfully set up Android Studio and Kotlin on Ubuntu 24.04, created your first Android project, and even run it on a device. Android development with Kotlin offers a modern and productive way to build apps. Keep exploring the Android Studio features, learning more about Kotlin syntax and Android APIs, and you'll be creating more complex and useful apps in no time.

References#