Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 104 ยท Getting Started

Setting Up Android Studio

Install Android Studio, use the SDK Manager, choose between an emulator and a real device, create an AVD and walk through the new-project wizard options step by step.

Android Studio is the official IDE for Android development. It is built on the same platform as IntelliJ IDEA, so if you know Kotlin in IntelliJ, much will feel familiar. On top of that it adds the Android SDK tools, an emulator manager, a Logcat viewer, a layout and Compose preview and everything needed to build, sign and run apps.

This lesson walks through installation, the SDK Manager, running on an emulator or a real phone and the new-project wizard. Android Studio cannot run in your browser, so the steps and configuration here are read-only walkthroughs. The runnable stand-in at the end models what the wizard produces, so you can see how your choices affect the project.

What you need first

Android Studio is a large download and the emulator is demanding, so check these before you install.

  • A 64-bit computer running Windows, macOS (Intel or Apple silicon) or Linux. Check the current system requirements on the download page, because they change with each release.
  • Memory. 8 GB of RAM is a practical minimum, and 16 GB is comfortable if you run an emulator beside the IDE.
  • Disk space. Plan for many gigabytes. The IDE, SDK platforms, system images for the emulator and the Gradle cache grow over time.
  • A JDK. You do not need to install one. Android Studio bundles a JetBrains Runtime for the IDE and Gradle uses a JDK that the project is configured for. Leave the bundled one selected unless you have a reason to change it.
  • Hardware acceleration for the emulator. Windows and Linux use virtualization support (enabled in the BIOS, plus the Windows Hypervisor Platform feature on Windows). macOS provides it built in.

Installing and the first start

  1. Download Android Studio from the official Android developer site and run the installer for your system.
  2. On first launch, a setup wizard appears. Choose the Standard installation, which downloads the latest SDK platform, the platform tools and the emulator.
  3. Accept the licences when asked. The SDK components will not install without them.
  4. Wait for the downloads to finish. This can take a while on a slow connection.

When it finishes you land on the Welcome screen with options to create a new project, open an existing one or get a project from version control.

Keep Android Studio updated. Each release tracks a matching version of the Android Gradle Plugin, and a project created by a newer Studio may ask a very old Studio to upgrade before it opens.

The SDK Manager

The Android SDK is the collection of tools and platform files your builds use. You manage it in Tools > SDK Manager (or from the Settings dialog under Languages and Frameworks > Android SDK). It has two tabs that matter.

SDK Platforms. Each entry is one Android version, identified by a name and an API level (a single integer that increases with every release). Installing a platform gives you that version's framework classes to compile against. Install the newest stable platform for compileSdk. Add older ones only if you need to test on them.

SDK Tools. Command-line and support tools. The important entries:

Tool What it is for
Android SDK Build-Tools Packaging steps used by Gradle to build the app
Android SDK Platform-Tools adb, the bridge to emulators and devices
Android Emulator The virtual-device engine
Android Emulator hypervisor driver Acceleration on some Windows setups

You rarely need to open the SDK Manager after the first day, except to add a new platform or system image or when a build says a component is missing.

Emulator or real device

You need something to run your app on. You have two options and professionals use both.

Emulator (virtual device) Real device
Setup Create it inside Studio Enable developer options and USB or wireless debugging
Android versions Any you download, including previews Whatever the phone runs
Hardware features Simulated (camera, sensors, location) Real
Speed Depends on your computer Usually fast and true to life
Best for Testing sizes, versions, foldables, quick iteration Performance, camera, Bluetooth, real-world feel

Creating an emulator (AVD)

An emulator instance is called an AVD, an Android Virtual Device. You manage them in Tools > Device Manager.

  1. Click Create Device.
  2. Pick a hardware profile: a phone model with a screen size and density. A recent Pixel profile is a good first choice.
  3. Pick a system image, which is the Android version that will run inside. Download it if it is not installed. Images labelled with Google Play include the Play Store, which you need only to test things like Play services behaviour.
  4. Choose a name and finish. Press the play button next to the device to start it.

Make one phone AVD and one tablet AVD early. Later, Adaptive Layouts and Window Size Classes will use both.

Using a real phone

  1. Open Settings > About phone and tap Build number seven times to unlock Developer options.
  2. In Developer options turn on USB debugging (or Wireless debugging on recent Android versions).
  3. Connect the phone. Accept the "Allow USB debugging?" prompt on the screen.
  4. The phone then appears in the device drop-down at the top of Android Studio.

If the phone does not appear, check the cable (some are charge-only), try another USB port and confirm the prompt was accepted. On Windows you may need the manufacturer's USB driver.

The new-project wizard

Choose New Project on the Welcome screen. You will pick a template and then fill in a form.

Templates. For a Compose app choose Empty Activity. It creates one Activity that calls setContent with a greeting and a preview. Other templates exist for specific needs, but they teach you less because they hide more.

The configuration form:

  • Name. The app's display name, such as "Notes".
  • Package name. A reverse-domain identifier such as com.example.notes. It becomes the app's application ID on the device and in the Play Store. It must be unique and effectively cannot change after you publish, so choose it deliberately even for practice apps.
  • Save location. Any folder you like.
  • Minimum SDK. The oldest Android API level your app supports. The wizard shows what percentage of devices that covers. A lower minimum reaches more users but limits the APIs you can call directly. For learning, accept the suggested value.
  • Build configuration language. Choose Kotlin DSL (build.gradle.kts). This is what the whole track uses.

After you click Finish, Studio syncs Gradle, downloads dependencies and indexes the project. The first sync can take minutes. When it is done, press the green Run button with your AVD selected, and the greeting app appears in the emulator.

TEXT
# read-only: what a freshly generated Empty Activity project contains
Notes/
  settings.gradle.kts
  build.gradle.kts
  gradle/libs.versions.toml
  app/
    build.gradle.kts
    src/main/AndroidManifest.xml
    src/main/java/com/example/notes/MainActivity.kt
    src/main/res/...

Every file in that tree is explained in Anatomy of an Android Project.

A model of the wizard's choices

The wizard collects a handful of values and turns them into files. This stand-in does the same in plain Kotlin. It is not Android Studio: it only models how the name, package and minimum SDK flow into the generated project, and it enforces the package-name rules you must follow in the real wizard.

Kotlin A mini new-project wizard

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with readln()), it gets the next line from this box.

Package names map directly to folders: the dots in the application ID become directory separators in the source tree. A hyphen is not a valid character in a Java or Kotlin package, which is why the last example fails.

Activity templates in the wizard

The Empty Activity template is the right start for a Compose app, but the wizard lists others. Knowing what they generate helps you read older projects, many of which began from one of them:

Template What it generates
Empty Views Activity One Activity with an XML layout (the View-system starting point)
Basic Views Activity Activity plus a toolbar, a floating action button and a navigation graph with two fragments
Navigation Drawer Views Activity A drawer with menu entries and one fragment per entry
Bottom Navigation Views Activity A bottom bar with three fragments and a nav graph
Responsive Views Activity Adapts navigation to the window size (rail, drawer or bottom bar)
Game Activity (C++) A native activity for games
Login / Settings (older templates) A login form with validation, or a preferences screen
Master/Detail, Tabbed, Fullscreen (older templates) Two-pane list and detail, a TabLayout with a pager, or an immersive screen

Exact names and the list itself change between Android Studio versions, and template code is a starting point, not a pattern to keep. Several screens that older templates generated by hand (tabs, drawers, settings, login) are one function call in Compose and Navigation: see Tabs and pager, Bottom navigation and Scaffold and app bars.

Will the app run on this device?

The minimum SDK you choose in the wizard decides which devices can install your app. This second stand-in models the check the installer makes, using a few example AVDs. It is a simplification: real installation also considers CPU architecture and required features.

Kotlin Which AVDs can install the app?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with readln()), it gets the next line from this box.

Raising minSdk shrinks the list of devices you reach, but lets you call newer APIs without version checks. That trade-off is why the wizard shows a coverage estimate.

When something goes wrong

  • "SDK location not found". Open the SDK Manager and set the SDK path, or create the file local.properties with sdk.dir pointing at it. Studio normally writes this file for you.
  • Gradle sync fails. Read the first error in the Build tab, not the last. A missing platform or an unreachable repository is the usual cause. Press Try Again once the network is fine.
  • The emulator is slow or will not start. Confirm that virtualization is on, use a system image matching your CPU architecture and close other heavy programs.
  • The device does not appear. Revisit the real-phone steps and check that the debugging prompt was accepted.

Tools for reading what the app prints while it runs are the topic of Running, Debugging and Logcat.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does an API level identify?

    Each Android release has an integer API level. minSdk, targetSdk and compileSdk are all expressed in API levels.
  2. 2. Which tool in the SDK Tools list gives you the adb command?

    adb ships in Platform-Tools. It is the bridge Studio uses to talk to emulators and devices.
  3. 3. Why should you choose the package name of an app carefully?

    The package name becomes the application ID that identifies your app on devices and in Google Play.
  4. 4. A phone does not show up in Android Studio. Which is NOT a likely fix?

    compileSdk affects compilation, not whether a device is detected. Debugging settings, the prompt and the cable are the usual causes.

Summary

  • Android Studio bundles the IDE, SDK tools, emulator manager, Logcat and previews; the Standard setup is the right first choice.
  • The SDK Manager installs platforms (API levels) and tools such as Build-Tools and Platform-Tools.
  • Use an emulator (AVD) for versions and screen sizes and a real device for performance and hardware; enable USB or wireless debugging on the phone.
  • The new-project wizard asks for a template, name, package (application ID), minimum SDK and Kotlin DSL; choose Empty Activity for Compose.
  • Most first-day problems are SDK path, Gradle sync, virtualization or device-debugging settings.

Next, look inside the project the wizard created in Anatomy of an Android Project.