Tutorial 3
Understand the first Android project.
Beginners often get lost because Android projects contain many files. In Phase 1, focus on a small set: MainActivity, build files, manifest, and resources.
Files that matter first
| MainActivity.kt | Your first screen starts here. Compose UI is usually called from setContent. |
|---|---|
| build.gradle.kts | Dependencies, plugins, SDK versions, and build settings. |
| AndroidManifest.xml | Declares app components and permissions. |
| res/ | Strings, colors, icons, themes, and other resources. |
MainActivity pattern
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
HabitApp()
}
}
}
@Composable
fun HabitApp() {
Text(text = "My first Android app")
}The activity hosts the screen. The composable describes the UI. Keep that distinction clear from the beginning.
Practice task
- Find MainActivity.kt in your project.
- Rename the first composable to something meaningful.
- Find the app name string in resources if your template created one.
- Write down which file you would open to change UI, app name, and dependencies.