Reading Time: 5 minutes

Creating a new Android Studio Project for Kotlin or Java is one of the first steps in every tutorial you will follow along either on this site or any other, that’s why even though there are many options and references on how to do it, I decided to create my own version of this, as some may be too complicated or hard to understand.

Installing Android Studio

For the purpose fo this tutorial I will assume that you have already installed Android Studio if you haven’t don’t worry, just go to their site and download the latest version available for your Operating System, follow the installation process with the default options and you will be ready to go.

Creating a new Android Studio project for Kotlin

When you first open Android Studio you will see the welcome screen (Image 1) with various options, click on “+ Start a new Android Studio project“.

Image 1. Android Studio Welcome Screen

Choose a project template

Android Studio provides a series of templates to start a project (Images 2 and 3), among versions you will notice these templates vary, the easiest and most common way to start is with an empty activity unless you have other very specific need. So choose the “Empty Activity” template and click on Next.

Image 2. Android Studio project templates part 1
Image 3. Android Studio project templates part 2

Project Configuration

Next, you will have the possibility to configure your project settings, you will have 5 fields as shown in image 4:

  1. Name of the application – This field is self-explained, you will add here the name you want your application to have.
  2. Package name – This field by convention follows a reverse URL name, for example, my webpage is evanamargain.com, then I reverse it com.evanamargain. and then add the name of the project, I could add .android.myapplication or just .myapplication.
  3. Save location – the path on your computer where you want to save it, for example, in your Desktop.
  4. Language – It will give you two options, Kotlin or Java, the two languages in which you can write native Android applications.
  5. Minimum API level – The minimum API level refers to the oldest version of Android you will be supporting in your app. If you click on ‘Help me choose’ you will see the number of devices you will support, use the default and change it afterward if you see it’s needed. For tutorials generally, you will have no problem with any chosen version and otherwise, the author will let you know.
  6. Instant apps – This is a checkmark found at the bottom, not needed for most tutorials. Instant apps are a fairly new feature and if you are curious you can look at Android’s official documentation on it here.
Image 4. Project Configuration

Done!

That was it, easy right? You created a new Android Studio project for Kotlin, now you should be seeing a screen like the one in Image 5 and ready to start your new project or tutorial. Usually, Android Studio will automatically open both MainActivity.kt and activity_main.xml.

In this screen you will see three main items:

  1. The project folders to the left.
  2. Code you are editing in the right.
  3. Terminal, Build or Logs (among other useful tools) at the bottom.
Image 5. Project start

Project Structure

The Project structure is very important. Here you will be locating the files where you will be editing code. Some key files here are, you can see expanded folders in Image 6. Make sure the two elements on the top left corner are the same: Project, and Android. The main folders you will be needing are:

  1. java – This contains all your Kotlin or Java code, yes, it will also contain the Kotlin code even when it’s called java. If your project is structured in a certain architecture or pattern this is where you will find the structure of it in folders such as model, view, view model, utilities, etc.
  2. res folder which stands for resources, this contains usually 4 folders but may have even more.
    1. Drawable: this folder contains images, that can be XML image files, SVG, JPG, PNG or anything related to images.
    2. Layout: This contains the UI of your app, mainly it consists of XML layout files.
    3. Mipmap: This folder is only for your launcher icons, android provides custom ones but you can follow the sizes to create your own.
    4. Values: This is a folder intended for reusable items in the app. Colors can be defined as constants in a file and reused across the app, you could, for example, create a ‘button_color’ and all items in the app that are buttons could use this color, if you want to change the color of all buttons across the app, you just need to change this color and all items will inherit it. Another useful application of the values files is that here you can specify files for different languages and translate your app easily.
Image 6. Folder structure (left pane)

That’s it! Now go create something awesome in this new project! If you liked the content on this post, please follow me at the bottom of the page. You can also buy me a coffee to support me!

Until next time!

Evana Margain Puig

(Visited 87 times, 1 visits today)