Coding Bihar

Creating an app in Jetpack Compose

Creating an app in Jetpack Compose  - Coding Bihar
Creating an app in Jetpack Compose

How I Created an app using Jetpack Compose

Welcome to codingbihaar.com in this tutorial we will learn to create a new project in Android Studio.
An  Android Studio an IDE for building and testing Android App. If you are beginner and you don't have any idea of about IDE then it is the best IDE for you to build an Android App as it is by Google.
We can not only build android apps for smartphones using android studio but also build apps or tools for devices which run on Android such as Cars, TVs, watches etc.

Download a latest version of Android Studio and install it on your PC, after a successful installation we launch the IDE by double clicking on the Icon in the download folder where Android studio was saved and follow the following steps to create a New Project in Android Studio.

Why you should use Android Studio?

  1. It is developed by Google.
  2. It is free the platforms where you can build apps without coding are paid.
  3. It has feature of live rendering that makes our coding time faster.
  4. It has emulator that allow us to test our App on a range of different devices available in the market.
  5. It has Project Template and sample project to learn.
  6. It has inbuilt Gemini AI .
  7. It is easy to use.
  8. We can access training and courses free and paid both for it.

What is jetpack compose?

jetpack compose is the latest toolkit for building Android App's UI  based on Kotlin language and the version which we are using for this tutorial is Android Studio Koala 🐨 the latest version by Google.

How to create a Project in Android Studio?

Steps :

If you don't have Latest version please Install the Latest version of  Android Studio  from the Official Website : https://developer.android.com/studio

1. Create a new project by selecting New Project If you re on welcome screen.
If you are already opened the project then to create a New Project Go to File > New > New Project
2. Select Empty Compose Activity and select the Phone and Tablet category then click Next..

3. Set the Name, Package name in my case it is Coding Bihar. Accept all other defaults.

 Note : Kotlin is the only available option because Jetpack Compose works only with classes written in Kotlin.In the Minimum API level dropdown menu, select API level 26 or higher.

4. Click on Finish

To know more about Jetpack Compose and learn what you can do with the toolkit, read the basic tutorial on Jetpack Compose.


Empty activity

Write the project name

Now we have the following  window of this is the Android Studio Latest version at the time of writing this post so it may be a little different UI  if you have different version so don't worry now you can run your program on your real device or Android Emulator. 

MainActivity

image


OUTPUT : This is the result when we run our First Android App.

Create a project Hello World using Jetpack Compose

How to edit module-level Gradle build file?

If you want to use Relay Gradle plugin you have to add Relay plugin in the module's Gradle file.
1. To add relay gradle plugin Click on Gradle Script and open the build.gradle file.
2. Add the below code in build.gradle file and 
 plugins {
  id("com.android.application")
  id("kotlin-android")
  id("com.google.relay") version "0.3.12"
}
3. click on Sync Now.
Note: Relay supports Jetpack Compose version 1.2 or newer versions.

App Gradle Relay Plugin

Also Read

Jetpack Compose Components

 Sandeep Gupta

Posted by Sandeep Gupta

Please share your feedback us at:sandeep@codingbihar.com. Thank you for being a part of our community!

Special Message

Welcome to coding bihar!