Your First Kotlin Android App: An App From Scratch

Aug 15 2023 · Kotlin 1.8.20, Android 13, Android Studio Flamingo | 2022.2.1

Part 1: Get Started with Android Development

04. Setup a Project in Android Studio

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 03. Challenge: Plan the App Next episode: 05. Run the App

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 04. Setup a Project in Android Studio

Android Studio Download Page

Android Studio Icon from ICONS8

Transcript: 04. Setup a Project in Android Studio

To begin building the Bullseye app, you need an Integrated Development Environment known as an IDE for short. An IDE simply combines different developer tools into a single app. And Android Studio is the main IDE for building Android apps.

You’ll use this development environment to design the app and write the code for this project.

And it is bundled with a lot of awesome features like:

  • Smart code completion
  • Errors and warning highlights
  • Tips and actions to help refactor your code
  • A powerful device emulation tool to test out your app during development without having to use a physical device
  • And so much more…

Believe me, Android Studio is a very powerful IDE, and you’ll really get to see it shine as you progress down the learning path.

Okay, so now it’s time to install Android Studio.

You first need to go to the Android Studio download page in your browser. You can get here by googling for Android Studio or using the following link in your web browser.

I’ve also added the link in the author’s notes too, so you can go ahead and click it.

Click on the “Download Android Studio” button and make sure you’re downloading the Flamingo or a higher version. This pops up a terms and conditions dialog. Make sure you read through it, then scroll down to accept the terms and conditions by clicking on the checkbox.

Next, you need to select the version of Android Studio you want to download depending on your operating system. If you’re using a Mac with an Intel chip like Core i5 or Core i7, then you select the Mac with Intel chip. I’m on a MacBook M1 Pro laptop, so I’ll select the one with the Apple Chip.

Then, once it’s done downloading, open the installer and install it in the location of your choice. Most of the time, the default settings during installation work fine.

Once you’re done with the installation or when you open Android Studio for the first time, the welcome dialog is displayed. In here, you’ll see the list of projects you’ve opened recently. If this is a new installation, then this tab will be empty.

To create a new Android project, click on the “New Project” button. This opens up a “New Project” window.

You can create Android apps for phones and tablets, Wear OS, Android TV, and Automotive.

You will focus on creating apps for phones in this course.

Now, this wizard gives you different starter templates to choose from. These starter templates help you create required files and folders depending on the type of application you want to create.

Since this is your first Android app, you’ll be starting from scratch so go ahead and select “Empty Activity” which creates a Jetpack Compose app. Don’t worry about what Jetpack Compose and an Activity are, you’ll be learning about that later on in this course.

And a side note, the old way to create Android apps was to use an “Empty Views Activity.” You’ll learn why we are going with the Jetpack Compose approach later on in this part.

Alright, after selecting the template, click on the “Next” button.

In this section, you set up the properties for your project. First, let’s give the application a name. Enter “Bullseye.”

Next is the package name, which is a unique identifier for your apps. This helps us make our application unique on platforms like Play Store. It makes use of a reverse domain format. So instead of yourcompany.com, you enter com.yourcompany.bullseye. If it’s a personal project, you can use com.yourusername.appname where appname would be replaced with the actual app’s name. I’ll go ahead and use com.yourcompany.bullseye for this project since this is just a demo.

Next is the save location. You can click on the folder icon on the right to browse to a specific save location on your computer. Android Studio creates an AndroidStudioProjects directory when you install it. You can save it to that directory or some other place if you want. I’ll go ahead and select a save location inside this directory.

Finally, we have the Minimum SDK selection. A SDK is just a pre-built library of tools to help development.

This step is important as it determines how widely available your apps can be for the general public. API 24, which is Android 7.0, is automatically selected. And this means that your app would work on phones running on Android 7 and up.

Now you might be wondering: “Android 7 is pretty old, why can’t we just choose something higher?” Alright, let’s unravel this mystery together.

Go ahead and click on the “Help me choose” link to learn more. From the left, you can see the Android version, the API level, and then the percentage of devices running on those versions.

On the right, you can see the new features that comes with those versions. As a developer, you try to support older devices because let’s face it, not everyone is going to be using the latest Android phone.

And you can see that if you select something like Android 13, only over 5% of devices would be able to run your app. Now, remember this is the Minimum SDK selection. Emphasis on the word “Minimum.” This means that you can still make use of cool new features of the latest Android platform and can always provide fallback options.

Okay enough of that, let’s close this window. Then click on the “Finish” button.

Android Studio sets up the Android application. It downloads all the necessary dependencies for the application to work. This should be done within a few seconds or minutes depending on your internet speed.

Sometimes, you’ll see a “Tip of the Day” dialog to learn tips on how to use Android Studio effectively.

Now, Android Studio’s user interface can be a bit intimidating at first, but you just need to focus on two main parts at the moment:

  • The project navigator and
  • the Editor.

The project navigator panel is a section of the IDE that displays the files and folders associated with a project. While the Editor is the largest open section of Android Studio.

This is where you’ll write your code and view open files. You can see a Kotlin file named MainActivity.kt is currently open.

Don’t worry about what the jargon in this file means for now. You’ll gain an understanding of it as you progress through this course.

You’ll be working mostly with these two interfaces and will use other parts of the IDE when necessary.

And now we are ready to start developing Android apps with Android Studio.

But where do we run and test our app during development? Let’s talk about that in the next episode.