Your First Android App: Hello World with Kotlin and Jetpack Compose
Create your first Android project, understand every line of MainActivity.kt in plain English, and run your Hello World app on an emulator or your phone.
This is the fun part. Today you will build your first Android app — the classic "Hello World" — and run it on an emulator or your own phone. It takes about 10 minutes.
Make sure you have Android Studio installed first. If not, follow Part 2: How to Install Android Studio.
Step 1: Create a New Project
- Open Android Studio.
- Click New Project.
- Choose Empty Activity (the one with the Compose logo) and click Next.
Now fill in a few details:
- Name:
My First App - Package name: leave it as it is (for example
com.example.myfirstapp) - Save location: any folder you like
- Minimum SDK: leave the default
Click Finish. Android Studio will now prepare your project. The first time, this can take a few minutes. Watch the progress bar at the bottom.
Step 2: Look Around (Don't Panic!)
You will see lots of files and folders. Don't worry — you only need one file today:
app → kotlin+java → com.example.myfirstapp → MainActivity.kt
Double-click MainActivity.kt to open it. This is the main door of your app. When someone opens your app, Android starts here.
Step 3: Understand the Code
You will see code similar to this:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
MyFirstAppTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Greeting(
name = "Android",
modifier = Modifier.padding(innerPadding)
)
}
}
}
}
}
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
}
Let's read it in plain English:
class MainActivity– this is one screen of your app, called an Activity.onCreate– "when the app opens, do this".setContent { ... }– "show this on the screen".MyFirstAppTheme– gives your app its colors and fonts.Scaffold– a basic page layout that keeps content away from the status bar.Greeting(...)– shows our greeting.@Composable fun Greeting– a small piece of UI. It shows the textHello Android!.
The @Composable label is important. It tells Android: "this function draws something on the screen."
Step 4: Change the Text
Let's make it yours. Change "Android" to your name:
Greeting(
name = "Shakil",
modifier = Modifier.padding(innerPadding)
)
Step 5: Run Your App
- At the top of Android Studio, choose your emulator or connected phone from the device list.
- Click the green ▶ Run button (or press
Shift + F10on Windows). - Wait a moment…
Your app opens and says Hello Shakil! 🎉
Congratulations — you are officially an Android developer!
Bonus: Use the Preview
You don't have to run the app every time to see changes. Add this below your Greeting function:
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
MyFirstAppTheme {
Greeting("Shakil")
}
}
Now click Split at the top right of the editor. You'll see your screen update live as you type. This saves a lot of time.
Common Beginner Errors
"Unresolved reference" (red text).
You are missing an import. Click the red word and press Alt + Enter (Windows/Linux) or Option + Enter (Mac), then choose Import.
Gradle sync failed. Check your internet and click Try Again at the top. Gradle is the tool that builds your app, and it sometimes needs to download things.
Nothing happens when I press Run. Make sure a device is selected in the device list, and the emulator is fully started.
Frequently Asked Questions
What is an Activity? An Activity is a screen or entry point of your app. Most modern Compose apps have just one Activity and draw all screens inside it.
What is Gradle? Gradle is the tool that turns your code into an app you can install. Android Studio uses it automatically.
Where is my app file (APK)? Android Studio builds it for you when you press Run. Later you can create one yourself with Build → Build APK(s).
Quick Recap
- You created a project with the Empty Activity template.
MainActivity.ktis where your app starts.@Composablefunctions draw the UI.- You ran your app and changed the text.
Next, let's learn the language behind all this. In Part 4: Kotlin Basics for Android Beginners, you will learn variables, functions and more, in plain English.