Step 2: Android Studio Setup — Install, Configure and Run Your First App

📚 Learn Android with Kotlin — Series
1. Kotlin 2. Android Studio 3. Activities 4. Intents 5. Fragments 6. RecyclerView 7. ViewModel 8. Room 9. Retrofit 🔒 10. Material 🔒 11. Firebase 🔒 12. Testing 🔒 13. Publish 🔒

You've learned Kotlin syntax. Now you need somewhere to actually write it. Android Studio is Google's official IDE for Android development — and it's free, powerful, and a little overwhelming the first time you open it.

Kotlin programming basics for Android development

Step 2 of the Learn Android with Kotlin series — Android Studio Setup

This step walks you through the full setup: downloading and installing Android Studio, creating your first project with the right settings, understanding what all the files do, enabling ViewBinding, and running your app on an emulator. By the end you'll have a working Android project on your screen ready for Step 3.

Why Android Studio?

Android Studio is built specifically for Android — it's not a generic IDE with Android plugins bolted on. It gives you:

  • Layout Editor — drag and drop UI design with live preview
  • Logcat — real-time logs from your app and device
  • Profiler — CPU, memory, and network usage in real time
  • Emulator — run any Android device configuration without physical hardware
  • Kotlin-first — built-in Kotlin support, code completion, refactoring
  • Gradle integration — build system that handles dependencies automatically

System Requirements Before You Download

Minimum Recommended
RAM 8 GB 16 GB
Disk space 8 GB 16 GB (SSD)
Screen 1280 × 800 1920 × 1080
OS Windows 10, macOS 10.14, Ubuntu 20.04 Latest version of each
Java JDK 17+ Bundled with Android Studio — no separate install needed
💡 About JDK: Android Studio bundles its own JDK — you don't need to install Java separately. If you have a previous Java installation, Android Studio will use its own bundled version and ignore it.

Step 1 — Download and Install Android Studio

Download

  1. Go to developer.android.com/studio
  2. Click Download Android Studio — it auto-detects your OS
  3. Accept the terms and conditions and download

Install

Windows:

  1. Run the downloaded .exe installer
  2. Check "Android Virtual Device" when prompted — this installs the emulator
  3. Accept default install location
  4. Launch Android Studio from the Start menu

macOS:

  1. Open the downloaded .dmg file
  2. Drag Android Studio into your Applications folder
  3. Launch from Applications or Spotlight
  4. If macOS blocks it: System Preferences → Security → Open Anyway

Linux:

  1. Unpack the downloaded .tar.gz to your preferred location
  2. Navigate to android-studio/bin/
  3. Run ./studio.sh to launch

First Launch Setup Wizard

On first launch Android Studio runs a setup wizard:

  1. Select Standard installation type
  2. Choose a UI theme (Darcula for dark, IntelliJ for light)
  3. Let it download the Android SDK — this takes a few minutes
  4. Click Finish

Step 2 — Create Your First Project

New Project Settings

  1. From the Welcome screen click New Project
  2. Select Empty Views Activity — the simplest starting template
  3. Click Next and fill in:
    • Name: MyFirstApp
    • Package Name: com.yourname.myfirstapp
    • Save Location: a folder you'll remember
    • Language: Kotlin
    • Minimum SDK: API 26 (Android 8.0)
  4. Click Finish
⚠️ About Minimum SDK: Many tutorials still suggest API 21 (Android 5.0, 2014). In 2026 less than 1% of active Android devices run below API 26. Setting API 26 as minimum gives you access to modern APIs, better performance, and simpler code — with virtually no real device coverage lost. For most apps, API 24 is the absolute floor.

Step 3 — Understanding the Project Structure

Android Studio opens your new project with a lot of files. Here's what actually matters for a beginner:

MyFirstApp/
├── app/
│   ├── src/
│   │   └── main/
│   │       ├── java/com/yourname/myfirstapp/
│   │       │   └── MainActivity.kt      ← Your first Activity
│   │       ├── res/
│   │       │   ├── layout/
│   │       │   │   └── activity_main.xml ← Your first screen layout
│   │       │   ├── values/
│   │       │   │   ├── strings.xml       ← Text strings
│   │       │   │   └── themes.xml        ← App colors and style
│   │       │   └── drawable/             ← Images and icons
│   │       └── AndroidManifest.xml       ← App configuration
│   └── build.gradle.kts                  ← App dependencies
└── build.gradle.kts                      ← Project-level build config

The Three Files You'll Touch Most

MainActivity.kt — the Kotlin code for your first screen:

package com.yourname.myfirstapp

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}

activity_main.xml — the layout that defines what the screen looks like. Open it in Android Studio and you'll see a visual editor on the right and XML on the left.

AndroidManifest.xml — the app's ID card. Registers every Activity, declares permissions, and sets the launch screen.

Step 4 — Enable ViewBinding (Do This Now)

ViewBinding is how modern Android code accesses views safely — no findViewById(), no null crashes. Enable it now before writing any code, because every post in this series uses it - starting with Step 3: Activities, Layouts and Views.

Open app/build.gradle.kts and add inside the android { } block:

android {
    // ... existing config

    buildFeatures {
        viewBinding = true
    }
}

Click Sync Now in the yellow banner that appears. Then update MainActivity.kt to use ViewBinding:

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        // Now access views safely — no findViewById needed
        // binding.tvHello.text = "Hello from ViewBinding!"
    }
}
✅ Why ViewBinding matters: findViewById() returns null if you mistype the ID — a crash at runtime. ViewBinding generates a type-safe class from your layout — if you mistype, it's a compile error you catch before running. All code in this series uses ViewBinding.

Step 5 — Set Up an Emulator

  1. Go to Tools → Device Manager
  2. Click Create Device (or the + icon)
  3. Select a hardware profile — Pixel 6 is a good choice
  4. Click Next → select a system image — choose the latest API 35 (download if needed)
  5. Click Finish

Run Your App

  1. Press the green ▶ Run button (or Shift + F10 on Windows / Ctrl + R on Mac)
  2. Select your emulator from the list
  3. Wait for it to boot — first boot takes 1–2 minutes
  4. You should see "Hello World!" on the emulator screen 🎉

Common Issues and Fixes

Problem Fix
Emulator is very slow Enable Hardware Acceleration in BIOS. In AVD Manager → Edit → increase RAM to 2048 MB
Gradle sync failed Check internet connection. Try File → Invalidate Caches → Restart. Check build.gradle.kts for typos
Missing SDK components Go to File → Settings → Android SDK → SDK Tools tab → check missing items → Apply
ActivityMainBinding not found ViewBinding not enabled. Check buildFeatures { viewBinding = true } in app build.gradle.kts and sync
Physical device not detected Enable USB Debugging: Settings → Developer Options → USB Debugging. Install device USB drivers on Windows

Using a Physical Android Device (Optional)

Running on a real device gives faster performance than the emulator. Here's how to set it up:

  1. On your Android phone: Settings → About Phone → tap Build Number 7 times to unlock Developer Options
  2. Go to Settings → Developer Options → enable USB Debugging
  3. Connect your phone to your computer via USB
  4. When prompted on the phone, tap Allow for USB debugging
  5. Your device appears in Android Studio's device selector — select it and run

Try It Yourself

  1. Change "Hello World!" — open res/values/strings.xml and change the hello_world string to your name. Run the app and see the update.
  2. Add a Button — open activity_main.xml, drag a Button from the palette, and in MainActivity.kt use ViewBinding to set a click listener that logs a message with Log.d("TAG", "Button clicked!").
  3. Enable ViewBinding — if you haven't already, enable it in build.gradle.kts and refactor MainActivity.kt to use binding instead of setContentView.
👉 What's next?
Your environment is set up and your first app is running. In Step 3: Android Activities, Layouts and Views — How Every Screen Is Built we learn how Android screens are built — the relationship between Activities, XML layouts, and UI components.

Frequently Asked Questions

What minimum SDK should I choose?
API 26 (Android 8.0) in 2026. Less than 1% of devices run below this. Avoid API 21 — it forces compatibility workarounds for every modern feature and offers no meaningful coverage benefit.

What is ViewBinding and why enable it?
ViewBinding generates a type-safe class from your layout. Instead of findViewById() which crashes at runtime on a wrong ID, ViewBinding fails at compile time. Enable with buildFeatures { viewBinding = true } in app/build.gradle.kts.

How do I speed up the emulator?
Enable hardware acceleration in BIOS. Increase emulator RAM to 2048 MB in AVD Manager. Use x86_64 system images — they run much faster than ARM on Intel/AMD machines. A physical device is fastest of all.

Do I need to install Java separately?
No — Android Studio bundles its own JDK. No separate Java installation needed.

📝 Step 2 Summary
  • Download Android Studio from developer.android.com/studio — it's free
  • No separate Java install needed — JDK is bundled
  • Set Minimum SDK to API 26 — not API 21
  • Enable ViewBinding immediately — buildFeatures { viewBinding = true }
  • Key files: MainActivity.kt (code), activity_main.xml (layout), AndroidManifest.xml (config)
  • Run on emulator with ▶ Run or Shift + F10
  • Physical device: enable USB Debugging in Developer Options
  • Slow emulator? → increase RAM in AVD Manager, use x86_64 image

Pragnesh Ghoda

A forward-thinking developer offering more than 8 years of experience building, integrating, and supporting android applications for mobile and tablet devices on the Android platform. Talks about #kotlin and #android

Post a Comment

Please let us know about any concerns or query.

Previous Post Next Post

Contact Form