Introduction to Jetpack Compose : Zero to One ( 01 )

Okay, I'm not going to waste any time defining what Compose is, as I think everyone is familiar with it. The question is, why this blog instead of Google's official documentation?

As a beginner, I found Google's docs very difficult to understand. They're great for senior developers, but even they sometimes turn to Medium or Hashnode blogs for better understanding.

So, the answer is simplicity and speed.

I started writing blogs as my own notes and decided to share them with everyone. I believe in just 2 minutes, you can learn a lot of things very quickly.

Before we begin, here's a quick overview of Android Studio (feel free to skip if you prefer)

Creating a Compose Project :

  1. Open Android Studio and click on "Create a New Project."

  2. Select "Empty Activity."

We will discuss the other activities later.

Next, you need to set your Name and Package Name, along with a minimum SDK. I personally prefer the minimum SDK to be "Android Oreo" (Android 8.0) since it's going to be 2025 soon. The build configuration language should be Kotlin DSL, as this domain-specific language is used by all modern apps instead of Groovy.

now you will see a this kind of screen

If the project section is yellow, it means the project is building. During this time, you will see the Project View.

The Project View shows the entire project structure. If you upload it to GitHub, it will be in this folder structure.

Once the project builds successfully, you will automatically switch to the Android View. We usually code in the Android View because it makes managing the app easier. The build files are separated, so you don't have to worry about them after adding dependencies. The Android View is very easy to use and is shown below

Folder Structure :

In the Android View, you will see two main packages (folders) by default: App and Gradle Scripts. The Gradle Scripts folder contains all the build files, and you can find more details about Gradle in this blog: “Full Gradle Guide.”

*app

  1. manifests

    The manifests package contains AndroidManifest.xml, which includes all the permissions and root-level information about the app. We can modify the values here as needed.

  2. res

    This folder contains all the resource files, such as images and app icons.

  3. kotlin + java

    This is the package that will be used the most. Inside some subpackages, there is a MainActivity.kt file, which runs first by default (though we can change this) when we hit the run button. There is also a ui package that contains all the custom fonts, themes, and colors as well.

Feel free to share your insights in the comments.

1
Subscribe to my newsletter

Read articles from Sagnik Mukherjee directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sagnik Mukherjee
Sagnik Mukherjee

Native Android Developer and content creator