Chapters

Hide chapters

Android Fundamentals by Tutorials

First Edition · Android 14 · Kotlin 1.9 · Android Studio Hedgehog (2023.1.1)

2. Getting Started With Android Studio
Written by Fuad Kamal

To create Android apps, you must first install Android Studio. Android Studio is a customized IDE based on IntelliJ Platform, an IDE by JetBrains that provides powerful tools.

In this chapter, you’ll learn how to:

  • Set up Android Studio.
  • Set up a physical and emulated device for development.
  • Build, install and run an app on your device.

Getting Started

Open a web browser and navigate to https://developer.android.com/studio#downloads.

This is the download page for Android Studio. The Download button will first show you a terms and conditions page. Scroll to the bottom of the page after reading the agreement to proceed.

Note: This chapter assumes your computer is running macOS. However, because Android Studio supports Windows and Linux, this book provides instructions for those operating systems where possible.

Mark the checkbox acknowledging your agreement with the terms. Then, select the download button that suits your operating system and hardware.

This book uses Android Studio Hedgehog. “Hedgehog” is the nickname given to the version of Android Studio. If you want to use a version other than the current release, select “preview” atop the downloads page, which offers Beta and Canary Android Studio builds. Canary builds have the latest, cutting-edge features but are also the least stable. Use at your discretion. Beta builds offer early access to the next version of Android Studio. Sometimes, you might need or want to use a Beta build to use certain new features in Android or improved support for existing features.

As your computer begins to download Android Studio, in your web browser, navigate to https://developer.android.com/studio/install.

This page outlines how to install Android Studio. Follow the instructions and video relevant to your operating system until the “Welcome to Android Studio” window appears.

Note: With a slower internet connection, downloading all components might take time. Depending on your system’s configuration, an administrator’s or personal password might be required to complete installation.

Configuring Android Studio

Now that you have installed Android Studio, it’s time to configure it with the new UI. The chapters of this book all reference the new UI of Android Studio. To ensure you have this feature enabled, open Android Studio, click the Android Studio menu at the top and select Settings.

In the Settings dialog, expand Appearance & Behavior, select New UI and mark the Enable new UI checkbox.

Note: For further details on what the new UI covers, check out the New UI for Android Studio video by the Android Developers YouTube channel.

Your First Android Project

Finally, it’s time to create your first project. It’s important to note this chapter focuses on getting your first Android app running as quickly as possible. As such, you’ll encounter a few unfamiliar screens, but don’t worry — Chapter 6, “Advanced Jetpack Compose”, offers a detailed explanation.

On the Welcome screen, click New Project:

The Welcome screen disappears, and a new window takes its place. This is where you choose the type of device you want your project to support.

By default, Phone and Tablet is selected, showing a variety of screen types. Click Empty Activity to choose it as your preferred project setup. Click the Next button in the bottom-right of the window to move on to the next step.

Note: The subtitle of this screen, “Creates a new empty activity with Jetpack Compose”, references Jetpack Compose. In the upcoming chapters, you’ll learn all about Jetpack Compose and how it’s a giant leap forward from the traditional methods.

Now, this screen requires some crucial application details:

  1. Name is where you enter the app’s name. For this project, name the app Kodeco Chat.

  2. Package name provides a package name for the app, a concept you might be familiar with from Java or Kotlin. Make sure this field reads as com.kodeco.chat.

  3. Save location denotes where Android Studio will store the project. Create your project anywhere you want. Choose a save location that makes sense for your setup. Choose a dedicated directory per Android project to avoid confusion. The folder button to the right of the field provides a system navigator to help you select.

  4. Minimum SDK sets the minimum version of Android the app will support. This book requires apps to run API 28, or Android “Pie”, so ensure API 28 (“Pie”, Android 9.0) is selected.

  5. Build configuration language lets you choose between Kotlin or Groovy for the Gradle configuration scripts language. Until recently, you had to use Groovy, but now the default language for Gradle is Kotlin, allowing you to use a single language for all your Android development. You’ll learn all about Gradle configuration scripts in Chapter 4, “Gradle Basics: A Look Behind the Curtain”. It also lets you choose to use Gradle Version Catalogs. There are many advantages to using Version Catalogs, but you’ll learn about that later as well. For now, choose the default, Kotlin DSL.

  6. Finish, the button in the bottom-right of the window, completes the project setup. Click this when you’re ready to move on.

Android Studio uses this information and gathers the required libraries and resources to generate a new project. Depending on your Internet connection, this phase might take some time.

When that process finishes, Android Studio displays the new project with MainActivity.kt already open:

If you see Gradle Sync in Progress or progress bars at the bottom of the Android Studio screen, wait for it to finish.

Android Studio

With the project created, you’re ready to work on it. But don’t jump in so quickly. Android Studio is a robust piece of software. If you dive in too fast, you might find yourself lost.

Before you start building your app, take a moment to review what Android Studio has to offer.

  1. The first window that appears is the Editor. This window provides a space to edit your app’s source code. It includes tools like syntax highlighting, auto-completion for methods and objects, and the ability to set breakpoints in your code while debugging. You’ll learn more about breakpoints and debugging later in this chapter. You’ll spend most of your development time using the Editor to code your app.

  2. To the left of the Editor is the Project navigator. This window shows everything your project contains, including code and image assets. Android Studio provides a lot; you can see what by clicking the arrow to the left of the items in the Project navigator. There’s no need to worry about these files for now; you’ll get well-acquainted with them as you read this book.

Creating an Android Virtual Device

Note: If you have a physical Android device you want to use for development, skip to the next section.

Seeing your code is good, but running the app and seeing it in action requires a device — whether it’s real or virtual. Look at the button highlighted in the following image.

This button opens the Device Manager pane to show all the available devices. Go ahead and click this button to open the Device Manager pane.

If you have any physical Android devices connected, they’ll show here. This pane also lists the Android Virtual Devices available, usually abbreviated as “AVD”. An AVD is an emulator that acts as an Android device on your computer. This allows you to test your app without requiring a physical device. If you don’t have a physical device for testing, you’ll need to create a virtual device before you can run your app.

Click the “+” button at the top of the Device Manager pane.

A new window appears, titled Select Hardware. In this window, you can select the type of device you want your AVD to emulate.

Select Pixel 7 Pro from the list of virtual devices. This is an excellent choice because it closely emulates an actual device many people use.

In the bottom-right of the window, click the Next button to progress to the System Image window. In this window, you select the version of Android to run on your emulator.

A few tabs run along the top of the list. The most interesting is Recommended, which shows a list of Android versions that Google recommends you use when testing your apps. Currently, those versions are grayed out because they are not available on your computer. You can change this by downloading the latest version of Android recommended by Android Studio.

Select the highest API Level item in the table (in the book’s example, UpsideDownCake / API Level 34) and click Download in the Release Name column.

The Component Installer window appears and automatically downloads the selected version of Android.

Once the download is complete, click Finish in the bottom-right. The Component Installer window disappears, and the System Image window reappears. At this point, the latest version of Android is ready to use. To move on, click the Next button in the bottom-right of the window.

The next and final window for creating an emulated device is a summary of the characteristics the device will have.

This window allows you to name the AVD and to confirm other aspects of the device, such as the Android version. You don’t need to change anything here, so click the Finish button at the bottom-right of the screen to create the AVD.

The current window disappears. In the Device Manager pane listing the available AVDs and devices, your new AVD shows up and is ready for use:

Setting up an Android Device

Note: If you don’t have an Android device to use for development, read the previous section on how to set up an Android Virtual Device.

Before you can install the Kodeco Chat app on your device, you must prepare your device setup for use with Android Studio. But first, connect your Android device to your computer with a USB cable.

Note: If you’re using a Windows computer, you need to download a USB driver for your device. You can download the driver and find instructions for installing it at https://developer.android.com/studio/run/oem-usb.html.

On your device, open the Settings app. At the top, in the search bar, type “build number” to search for the Build number setting.

When you see the build number item, tap it several times until you see a message that you’re a few steps away from being a developer. Keep tapping away until another message lets you know you’ve become a developer.

Note: If your device is locked with a PIN, you must enter it before you can reach this stage.

So what did this magical button do? Tap the back button to go to the Settings page, then tap the System button. Can you see what to look for?

Note: On some devices, you might only need to tap back once to go to the Settings page.

A new item titled Developer Options shows up. Tap this new option to see all the available developer features.

There’s a lot to go through here. The only option you need right now is USB Debugging.

Find this option and switch it on. A confirmation dialog appears, informing you of the intended usage of USB debugging.

Granting USB debugging privileges is a potential security hole, so most devices have this turned off by default. You’ll need to turn this on because you need to install apps over USB using Android Studio.

When you’re ready, tap OK and the USB Debugging toggle is enabled.

Another popup may appear, asking to confirm your computer’s RSA key fingerprint.

This is another step Android takes to ensure no unauthorized computers can access your device data.

Because you’ve just enabled USB Debugging, it’s safe to assume this is your computer accessing the device. Click Allow; you can also check Always allows from this computer if you don’t want to give your computer permission every time you connect your device.

Congratulations, your device is now set up for development.

Running the App

It’s time to run Kodeco Chat! Along the top of Android Studio, there’s a dropdown with the name of your device:

To the right of the dropdown is a button that looks like a green Play button. This is the Run App button.

The dropdown allows you to select a device to run Kodeco Chat on.

Depending on what device you set up earlier in the chapter, the name of your physical device or your AVD will appear.

As long as a device is selected and appears in the closed dropdown button, it doesn’t matter which device you use.

With the device selected, click the Run App button. Android Studio begins building Kodeco Chat and installs the app onto your device. You can see this happening at the bottom of Android Studio.

When Android Studio finishes building and installing, Kodeco Chat will appear on your device:

Excellent, you just built your first Android App! Now, it’s time to make it a little more personal.

Back in Android Studio, in the Project navigator, open the file in app ‣ kotlin+java ‣ com.kodeco.chat ‣ MainActivity.kt.

Don’t stress about what’s in this file. Right now, all you need to know is that it’s code representing the app screen that appears on your device. You’ll learn more about this in the following chapters. For now, just update the value of Greeting in the onCreate function.

override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)
  setContent {
    KodecoChatTheme {
      // A surface container using the 'background' color from the theme
      Surface(
        modifier = Modifier.fillMaxSize(),
        color = MaterialTheme.colorScheme.background
      ) {
        Greeting("Android")
       }
    }   
  }
}

Update the value of Greeting() from “Android” to your name so Kodeco Chat says hello to you.

You might see the value change from “Android” to your name immediately on the device or emulator without having to rerun the app. If so, this is because of a Compose and Android Studio feature called “Live Edit”. You’ll learn much more about Compose in the upcoming chapters.

If you don’t see it update live, you could rerun the app or enable Live Edit in Android Studio’s settings. In the Android Studio menu, select Settings.

Note: On a Windows computer, click File, then select Settings.

In the Preferences dialog, type “Live Edit” in the search bar at the top left. It will take you directly to the “Live Edit” section of the Settings.

Select the “Live Edit” and “Push Edits Automatically” options if they aren’t already selected. In recent versions of Android Studio, these options should be selected by default.

To rerun your app, click the Run App button again:

Note: The Run App button has changed from a green play button to a green repeat button. Don’t worry about this for now. We’ll explain what’s going on in later chapters.

Installing New Versions of Android Studio

Note: This book assumes the most current version of Android is Android 14, known to developers as API version 34. However, a new version might exist. That said, you might want to install the latest versions of Android Studio and the Android SDK.

Google has decoupled Android Studio from versions of Android. This means you can build apps in Android Studio with any version of the Android operating system, including any future versions of the Android SDK.

Android Studio does its best to prompt you when new Android Studio or Android SDK versions are available. But you don’t have to wait for Android Studio to update.

In the Android Studio menu, you can select Check for Updates, which gives you a dialog showing the items you can update. It also lets you know if things are already up-to-date.

If you want to download a newer — or even an older — version of Android SDK, select Settings… from the same menu and then type “Android SDK” into the search bar to bring the menu items tree to Appearance & Behavior ‣ System Settings ‣ Android SDK.

This window has two noteworthy tabs: SDK Platforms and SDK Tools. In SDK Platforms, you’ll see a list of the available Android SDKs.

Check the box next to one or more of these SDKs, then click apply and then click OK in the confirmation dialog; this installs the selected SDKs.

In the SDK Tools tab, you’ll see a list of the available build tools that Android Studio and your app can access.

Check the box next to one or more of the tools, then click apply and then click OK in the confirmation dialog; this installs that tool. You’ll learn more about these tools later.

Key Points

Setting up an environment is often the first and most important step when diving into a new technology. To recap this chapter, you:

  • Learned how to download and setup Android Studio on your computer.

  • Created a new project for your first app.

  • Learned how to set up an Android Virtual Device and your Android device for development.

  • Changed the text that appears on the screen to say hello to you.

  • Learned how to update Android Studio and install new versions of the tools and SDKs it relies on.

Where to Go From Here?

Well done getting your first app up and running! This is just the beginning. The following few chapters in this section will teach you even more about the basics of Android development. As you work through the chapters in this book, you’ll end up with a full-featured app.

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.
© 2026 Kodeco Inc.