Skip to main content
AIDevOps
  • Learn
  • Learning Paths
  • Practice
  • Open Source
  • Books
  • Engineering

    AI DevOpsThe full map of building and operating AI servicesLLMOpsLLM deployment Β· evaluation Β· observabilityHands-on ProjectsBuild AI Agent projects

    Knowledge

    DocsTechnical documentationBlogEngineering articlesPloggerDevelopment log feed

    Validate

    Certification3-level skills certification Β· coming soon
AI Models
LlamaTutorial|MistralTutorial|GemmaTutorial|DeepSeekTutorial|QwenTutorial
πŸ“± Mobile
Mobile Intro & RoadmapKotlinAndroidFlutter
πŸ€– AI Applied Development
Applied AI Intro & RoadmapHugging FaceLangChainLlamaIndexLLMOps|LangGraphMCPMulti-AgentAgent Evaluation
🧠 AI Core
AI Intro & RoadmapML FundamentalsLLM Fundamentals|Python AIC++|PyTorchTensorFlowJAX
🧠 AI Agent Development
Finance AI AgentLLM API ServerStock Investing AgentAIOps AI AgentEducation AI AgentCoding AI Agent
🌱 Spring Cloud
Spring Intro & RoadmapSpring Cloud GatewaySpring BootJava|Spring AISpring SecuritySpring BatchSpring JPA
🐳 DevOps
DevOps Intro & RoadmapLinuxDockerCI/CD|Kubernetes BasicsK8s AdvancedPrometheusGrafana
🧱 Infrastructure
Infrastructure Intro & RoadmapNginxRedis
☁️ Cloud
Cloud Intro & RoadmapAWSGCPAzureNCPCloudflare
🎨 Frontend
Frontend Intro & RoadmapJavaScriptTypeScript|ReactNext.js|VueNuxt|Electron
βš™οΈ Backend
Backend Intro & RoadmapPython BasicsFastAPIDjangoFlask|CGoGinNode.js
πŸ’Ύ Database
DB Intro & RoadmapCore SQLOracleMySQLPostgreSQL|MongoDBVector DB
πŸ§ͺ Testing
k6JMeternGrinder
AIDevOps

Engineering AI. From Code to Production.
An engineering learning platform for building and operating AI and AI Agents

Learn

  • All Guides
  • Learning Paths
  • AI Tutorial
  • Practice
  • Books

Resources

  • AI DevOps
  • LLMOps
  • Hands-on Projects
  • Docs
  • Blog
  • Plogger
  • Open Source
  • Certification (coming soon)

Start Here

  • AI Core Roadmap
  • AI Applied Development Roadmap
  • Spring Cloud Roadmap
  • DevOps Roadmap
  • Infrastructure Roadmap

Β 

  • Cloud Roadmap
  • Frontend Roadmap
  • Mobile Roadmap
  • Backend Roadmap
  • Database Roadmap
Β© 2026 AIDevOps. All rights reserved.
Terms of ServicePrivacy PolicySitemaptestforge.kr
  1. Home
  2. Learn
  3. Mobile
  4. Android
The complete guide to Android development with Kotlin

πŸ€– Android Complete Guide

Visitors

From the moment you first open Android Studio to the moment you publish to the Play Store, this guide walks through the whole process of building an Android app with Kotlin and Jetpack Compose, one step at a time. It is organized so you understand the reasons behind each step as well.

  • Intermediate
  • Updated Oct 1, 2026
  • ~13 min read
  • 19 sections
  • 14 code examples
πŸ€–
Mobile app developmentJetpack Compose UINetworking with RetrofitMVVM architecturePublishing to the Play Store

Related frameworks & environments

πŸ…ΊKotlinβ†’πŸ¦‹Flutterβ†’

Contents

0 / 22
  1. How to use this guide
  2. Architecture diagrams
  3. What is Android development?
  4. Setting up the environment
  5. Creating your first project
  6. Understanding the project structure
  7. First steps with Compose
  8. Layout & Modifier
  9. State management
  10. List UI (LazyColumn)
  11. Navigating between screens
  12. ViewModel & lifecycle
  13. Networking
  14. Handling permissions
  15. Local data storage
  16. Writing tests
  17. Build and release
  18. Android design
  19. Operating standards
  20. Verification strategy
  21. Frequently asked questions
  22. Next steps
Contents 22 sections
  1. How to use this guide
  2. Architecture diagrams
  3. What is Android development?
  4. Setting up the environment
  5. Creating your first project
  6. Understanding the project structure
  7. First steps with Compose
  8. Layout & Modifier
  9. State management
  10. List UI (LazyColumn)
  11. Navigating between screens
  12. ViewModel & lifecycle
  13. Networking
  14. Handling permissions
  15. Local data storage
  16. Writing tests
  17. Build and release
  18. Android design
  19. Operating standards
  20. Verification strategy
  21. Frequently asked questions
  22. Next steps

How to use this guide

How to read it

Understanding Android as a real-world workflow

From the moment you first open Android Studio to the moment you publish to the Play Store, this guide walks through the whole process of building an Android app with Kotlin and Jetpack Compose, one step at a time. It is organized so you understand the reasons behind each step as well. Rather than listing concepts, this guide is organized so you can follow the content in the order you have to make decisions on a real project.

Key perspective

Frontend / app development

Do not stop at drawing the screen: look at state, data requests, routing, accessibility, and the unit of deployment together.

Mobile app developmentJetpack Compose UINetworking with RetrofitMVVM architecturePublishing to the Play Store

Architecture diagrams

To make what you read stick, it helps to capture the flow as a picture first. The two diagrams below are reference maps you can keep coming back to while learning Android.

Learning flow

Rendering diagram…

Architecture view

Rendering diagram…

What is Android development?

When you first open Android, the big picture matters more than individual commands. This section starts with the problems the concepts ahead were created to solve.

Android is the mobile operating system from Google that runs on more than 70% of the smartphones in the world. The first thing newcomers wonder is "which language and tools should I start with?", and the short answer is that the Kotlin language + the Jetpack Compose UI toolkit is the modern standard Google has officially recommended since 2024. Java + XML layouts used to be the standard, but if you are learning now there is no need to pick up the old way first. This guide uses only Kotlin and Compose from start to finish.

Compose may feel unfamiliar, but put simply it means declaring "what to draw on screen and how" directly as Kotlin functions instead of XML files. If you have worked with React or Flutter, the idea that "the screen redraws automatically when state changes" is exactly the same, so you will get used to it quickly. There is no need to worry if this is your first time β€” this guide explains each concept alongside real code.
AspectThe old wayThe way this guide covers
Writing UIXML layout filesKotlin @Composable functions
LanguageJavaKotlin (more concise and null safe)
Reflecting stateManual updates through findViewByIdAutomatic recomposition when state changes
Officially recommendedIn maintenance modeThe current official Google standard (2024 onward)

Tip

If you have to maintain an old in-house project written in Java/XML, that project should keep following that approach, but if you are starting to learn from scratch, beginning with Compose saves time.

Setting up the environment

Here you look at Setting up the environment alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

Android development needs exactly one thing: Android Studio, the official IDE. It includes the code editor, the Android SDK (the set of tools needed to build), and the emulator (a virtual smartphone), so there is no need to install several separate programs.
BASH
# The first time you launch Android Studio after installing, the "Setup Wizard" appears.
# Choose the Standard option and the Android SDK, build tools, and emulator image
# are downloaded automatically. (About 10-20 minutes depending on your connection)

# To confirm the install finished, go to the top menu:
# Android Studio > Settings > Languages & Frameworks > Android SDK
# and check that the latest SDK Platform (API 34 or higher) is ticked.
Operating systemHow to installNotes
WindowsDownload the .exe installer from the official site and run itKeep the "Android Virtual Device" item checked during installation
macOSDownload the .dmg from the official site (check Apple Silicon vs Intel)On an M1/M2/M3 chip, be sure to download the Apple Silicon build
LinuxExtract the .tar.gz from the official site and run studio.shA 64-bit distribution is recommended; KVM virtualization must be enabled

Tip

  • "What is an SDK?" β€” short for Software Development Kit, it is the bundle of tools and libraries needed to build and package Android apps. Android Studio manages it automatically, so you will rarely download it yourself.
  • If you have a real smartphone, you can connect it by USB and test right away. Go to Settings β†’ About phone and tap Build number 7 times in a row to unlock "Developer options", then turn on "USB debugging" there. It is much faster than the emulator.

Creating your first project

Here you look at Creating your first project alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

Launch Android Studio and choose New Project on the welcome screen. Picking Empty Activity from the template list starts you with just the minimal structure you need and no unnecessary sample code. (In recent versions of Android Studio that support Compose, Empty Activity is generated on Compose automatically.)
BASH
# When the project has been created, press the green β–Ά (Run) button in the top toolbar.
# If no real device is connected, Android Studio starts the emulator automatically
# and a moment later you see your first app showing "Hello Android!" on screen.

# If the emulator list is empty:
# click the Device Manager icon on the right β†’ Create Device β†’ choose Pixel 8
# β†’ download a system image (API 34 or similar) β†’ Finish
SettingMeaningRecommended for beginners
NameThe app name (the name people see)Anything you like (e.g. MyFirstApp)
Package nameThe globally unique identifier of the appReverse-domain form such as com.example.myfirstapp
Save locationThe folder where the project files are storedKeep the default
LanguageThe programming language to useKotlin (default)
Minimum SDKThe oldest Android version the app will supportAPI 24 (Android 7.0) β€” a baseline widely used in practice

Tip

"A lower Minimum SDK supports more devices but sometimes means you cannot use the newest APIs. Set it too high, on the other hand, and you lose users on older devices. API 24 is a practical baseline that balances the two well."

Understanding the project structure

Understanding the project structure is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.

When you first open a project, the file tree on the left is full of unfamiliar folders, which can be daunting. But the files you actually touch every day are a fixed few. Remembering just the ones in the table below is enough.
PathWhat is it?When do you open it?
app/src/main/java/.../MainActivity.ktThe entry point code called when the app first startsAlmost always β€” this is where you wire in your Composables
app/src/main/res/Resources such as images, icons, strings, and colorsWhen changing images or the app name
app/src/main/AndroidManifest.xmlThe configuration file that declares the app name, permissions, and list of screensWhen a permission such as the camera is needed
app/build.gradle.ktsThe libraries (dependencies) and build settings for this app moduleWhen adding a new library β€” the file you open most often
build.gradle.kts (project root)Common build settings applied to the whole projectAlmost never

Tip

"What is Gradle?" β€” the tool that builds (compiles + packages) an Android project. Think of it as the package manager of other languages, such as npm or pip, combined with library version management.

First steps with Compose: Composable functions

Here you look at First steps with Compose: Composable functions alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

In Compose, every piece of the screen is built as an ordinary Kotlin function annotated with @Composable. It is not special syntax, just a function, so you can call other Composables to combine them and take parameters to reuse them.

Looking at the example below line by line: Column is a layout that stacks its children vertically, Text displays text, and Button is a button that can be pressed. Calling the Composable we wrote inside the setContent { } block of MainActivity draws it on screen.
MainActivity.ktKOTLIN
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

// @Composable: marks "this function draws UI"
@Composable
fun Greeting(name: String) {
    Column(modifier = Modifier.padding(16.dp)) {
        Text(text = "Hello, $name!")
        Button(onClick = { /* code to run when the button is pressed */ }) {
            Text("Press me")
        }
    }
}

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // Calling a Composable inside setContent draws it on screen
        setContent {
            Greeting(name = "AI DevOps")
        }
    }
}

Tip

Put @Preview above a function and you can check the UI right in the right-hand panel of Android Studio without running the app. It is very convenient when checking small visual changes over and over, since you do not have to relaunch the app each time.

Layout & Modifier

Here you look at Layout & Modifier alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

Most Compose layout is handled by three basic containers. Column arranges its children vertically, Row horizontally, and Box stacks its children on top of each other. The idea is similar to flexbox in HTML/CSS.

A Modifier is the tool for attaching extra properties such as size, padding, alignment, and click handling by chaining calls. The important point is that the order in which Modifiers are written affects the result. For example, applying padding first and then the click area behaves differently from setting the click area first and then the padding. It is fine not to worry about the order at first, but if a layout comes out differently from what you expected, suspect the Modifier order.
KOTLIN
@Composable
fun ProfileCard() {
    Row(
        modifier = Modifier
            .fillMaxWidth()      // fill the full width of the screen
            .padding(16.dp),     // 16dp of outer padding
        verticalAlignment = Alignment.CenterVertically
    ) {
        Column {
            Text("Jane Doe")
            Text("Android developer")
        }
        Spacer(modifier = Modifier.weight(1f)) // takes all the remaining space (pushes the next item to the right)
        Text("Follow")
    }
}

Tip

"What is dp?" β€” short for density-independent pixel, a unit that makes things appear at a similar physical size across different screen resolutions. Think of it as always using dp where the web would use px.

State management: remember and mutableStateOf

Here you look at State management: remember and mutableStateOf alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

The core principle of Compose is that "when State changes, the UI that reads that state is redrawn automatically". This is called recomposition.

remember "remembers" a value so it is not lost when the Composable function runs again (recomposition), and mutableStateOf is an observable state holder that tells Compose "redraw the UI that reads this value" when the value changes. If you do not use the two together (for example, declaring just var count = 0), the value changes but the screen is not updated β€” the mistake first-time learners make most often.
KOTLIN
@Composable
fun Counter() {
    // remember: keeps the value across recompositions
    // mutableStateOf: when the value changes, the UI reading it is redrawn automatically
    // with the by keyword you read and write count directly instead of count.value
    var count by remember { mutableStateOf(0) }

    Column {
        Text(text = "Count: ${count}")
        Button(onClick = { count++ }) { Text("Increment") }
    }
}

Tip

To keep the value even when the Activity is recreated, as on screen rotation, use rememberSaveable instead of remember. The usage is nearly identical.

List UI: LazyColumn

Here you look at List UI: LazyColumn alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

Most app screens list many items, such as a list of posts or chats. Laying the items out one by one in an ordinary Column draws all of them at once when there are 100 or 1,000, and performance drops sharply.

LazyColumn behaves "lazily", as the name says: it draws only the items actually visible on screen and adds just what is needed as you scroll. It is the same idea as virtual scrolling in web development.
KOTLIN
data class Todo(val id: Int, val title: String)

@Composable
fun TodoList(todos: List<Todo>) {
    LazyColumn {
        items(todos, key = { it.id }) { todo ->
            Text(
                text = todo.title,
                modifier = Modifier.padding(12.dp)
            )
        }
    }
}

Tip

Giving items() a key lets Compose know exactly which items really changed when one is added or removed in the middle of the list, which improves animation and performance. Unless there is a specific reason not to, make a habit of always setting a key.

Navigating between screens (Navigation Compose)

Here you look at Navigating between screens (Navigation Compose) alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

With two or more screens, an app needs a way to move between them. The Navigation Compose library works by registering the navigable screens under "route" names and navigating by calling those names from code. If you have worked with URL routing in web development, the concept is very familiar.
KOTLIN
@Composable
fun AppNavHost() {
    val navController = rememberNavController()

    NavHost(navController = navController, startDestination = "home") {
        composable("home") {
            HomeScreen(onNavigateToDetail = {
                navController.navigate("detail") // go to the "detail" screen
            })
        }
        composable("detail") {
            DetailScreen(onBack = {
                navController.popBackStack() // return to the previous screen
            })
        }
    }
}

ViewModel and the lifecycle

Here you look at ViewModel and the lifecycle alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

When the screen is rotated, Android by default recreates the whole Activity. All state stored with remember is lost at that point. It would be very annoying for the text a user was typing or the data that was loaded to vanish on a single rotation.

A ViewModel is a separate class that survives this kind of screen recreation. The screen (the Composable) only subscribes to the state the ViewModel holds, and all the logic that creates and changes the actual data lives inside the ViewModel. Dividing the roles this way cleanly separates UI code from business logic and makes testing much easier (this is called the MVVM architecture).
KOTLIN
class CounterViewModel : ViewModel() {
    // private set: readable from outside, modifiable only inside this class
    var count by mutableStateOf(0)
        private set

    fun increment() { count++ }
}

@Composable
fun CounterScreen(viewModel: CounterViewModel = viewModel()) {
    Column {
        Text("Count: ${viewModel.count}")
        Button(onClick = { viewModel.increment() }) { Text("Increment") }
    }
}

Tip

viewModel() is a function provided by the androidx.lifecycle.viewmodel.compose package that automatically manages reuse of the same ViewModel instance across screen recreation. Always obtain it through this function rather than constructing it yourself.

Networking (Retrofit + coroutines)

Here you look at Networking (Retrofit + coroutines) alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

For REST API calls that fetch data from a server, the combination of the Retrofit library and Kotlin coroutines is the working standard. Putting the suspend keyword in front of a function means "this function may take time, and it will not block other work (such as drawing the screen) while it waits" β€” you can write it in order like synchronous code, with no callback hell.
KOTLIN
data class User(val id: Int, val name: String)

interface ApiService {
    @GET("users")
    suspend fun getUsers(): List<User>
}

val api: ApiService = Retrofit.Builder()
    .baseUrl("https://api.example.com/")
    .addConverterFactory(GsonConverterFactory.create())
    .build()
    .create(ApiService::class.java)

class UserViewModel : ViewModel() {
    var users by mutableStateOf<List<User>>(emptyList())
        private set

    fun loadUsers() {
        // viewModelScope: the coroutine is cancelled automatically when the ViewModel goes away
        viewModelScope.launch {
            try {
                users = api.getUsers()
            } catch (e: Exception) {
                // handle network errors, server errors, and so on here
            }
        }
    }
}

Tip

A coroutine started in viewModelScope is cancelled automatically when the screen goes away (when the ViewModel is cleared). That prevents the memory leak of a network request still running after the user has left the screen, so always make the call through viewModelScope.

Handling permissions

Here you look at Handling permissions alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

Accessing sensitive user information such as the camera, location, or storage takes two steps. First, declare which permissions are needed in AndroidManifest.xml. Second, while the app is running, actually ask the user for the permission and get approval (Android 6.0 and later use "runtime permissions", which ask at the moment of use rather than at install time).
XML
<!-- AndroidManifest.xml -->
<uses-permission android:name="android.permission.CAMERA" />
KOTLIN
@Composable
fun CameraScreen() {
    val context = LocalContext.current
    val launcher = rememberLauncherForActivityResult(
        ActivityResultContracts.RequestPermission()
    ) { granted ->
        if (granted) {
            // handle the case where the permission was granted
        } else {
            // denied β€” it is good to show guidance UI that explains why
        }
    }

    Button(onClick = {
        launcher.launch(Manifest.permission.CAMERA)
    }) {
        Text("Request camera permission")
    }
}

Tip

Users are more likely to refuse when a permission dialog appears out of nowhere with no reason given. Showing a short explanation of "why this permission is needed" right before asking is a good habit that raises the approval rate in practice.

Local data storage (DataStore)

Here you look at Local data storage (DataStore) alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

Simple settings that must survive closing and reopening the app (for example dark mode, or whether to stay signed in) are stored in DataStore. SharedPreferences used to be used for this, but DataStore is coroutine-based, so it does not block the UI thread, and the data can be observed as a Flow, which is why DataStore is recommended for modern projects. For complex data spanning several tables, use Room, a separate local database library.
KOTLIN
val Context.dataStore by preferencesDataStore(name = "settings")
val DARK_MODE_KEY = booleanPreferencesKey("dark_mode")

// Save
suspend fun setDarkMode(context: Context, enabled: Boolean) {
    context.dataStore.edit { prefs -> prefs[DARK_MODE_KEY] = enabled }
}

// Observe the value as a Flow β€” a new value arrives automatically whenever it changes
fun darkModeFlow(context: Context): Flow<Boolean> =
    context.dataStore.data.map { prefs -> prefs[DARK_MODE_KEY] ?: false }

Writing tests

Here you look at Writing tests alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

"How do I test UI?" is a part many beginners skip, but Compose makes UI testing fairly easy. You bring up a test screen with createComposeRule(), find text or a button, click it, and check the result. Logic that is separate from the UI, such as a ViewModel, can be verified much faster with plain Kotlin unit tests.
KOTLIN
class CounterTest {
    @get:Rule
    val composeTestRule = createComposeRule()

    @Test
    fun clickingButton_incrementsCounter() {
        composeTestRule.setContent { Counter() }

        // check the initial state
        composeTestRule.onNodeWithText("Count: 0").assertExists()

        // click the button
        composeTestRule.onNodeWithText("Increment").performClick()

        // check the state after the click
        composeTestRule.onNodeWithText("Count: 1").assertExists()
    }
}

Tip

You do not need to test every screen. To begin with, write tests for the core flows where a failure is critical, such as sign-in and payment.

Build and release

Here you look at Build and release alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

Once testing is done, it is time to ship the app to real users. An unsigned debug APK is enough during development, but publishing to the Play Store requires an AAB (Android App Bundle) file with a digital signature. Signing is the procedure that proves "this app really was built by me (the developer)".
BASH
# Build a debug APK for testing during development
./gradlew assembleDebug

# Build the release App Bundle for submission to the Play Store
./gradlew bundleRelease
StepWhat to do
1. Create a signing keyCreate a keystore file with the Build β†’ Generate Signed Bundle/APK wizard in Android Studio and keep it safe (if you lose it, you cannot update the same app)
2. Release buildBuild an AAB file signed with that keystore
3. Register in the Play ConsoleRegister as a developer in the Google Play Console (a one-time registration fee applies) and upload the AAB
4. Staged rolloutRolling out in stages β€” internal testing β†’ closed testing β†’ full release β€” is the safe way

Android practical design

Android practical design is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.

On Android, separate the Compose UI from the business logic at the ViewModel boundary. A structure in which State is managed as a single source of truth and the UI only subscribes to that state is better for maintainability.
Decision pointQuestion to askPractical guideline
BoundariesWhich parts of the Android code are most likely to change?Separate input/output, configuration, external integrations, and the core rules.
StateWhere is state created and where does it go away?Make the owner and lifecycle of state visible in the code.
FailureWhat does the caller receive on failure?Decide the timeout, fallback, and error contract first.

Android operating standards

This section covers Android operating standards from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.

The essentials in operation are coroutine scopes matched to the Lifecycle (viewModelScope), preventing memory leaks, background work (WorkManager), and APK/AAB size management.

Tip

  • Use of viewModelScope
  • State as a single source
  • ComposeTestRule UI tests
  • Handling process recreation

Android verification strategy

Android verification strategy is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.

With Compose, separate UI tests (ComposeTestRule) from ViewModel unit tests, and include screen rotation and process recreation scenarios in the regression tests.
Quality axisHow to verifyDefinition of done
CorrectnessAutomate the normal/failure cases.The core scenarios pass reproducibly.
Regression preventionWhen fixing a bug, leave the same case behind as a test.The same failure is not deployed again.
OperabilityCheck the logs, metrics, and alerts.There is a path for tracing the cause when a problem occurs.

Android: frequently asked questions

Should I learn Jetpack Compose or XML layouts?

If you are starting now, learn Jetpack Compose first. It is the UI toolkit Google recommends, and you write screens declaratively in Kotlin code. Existing apps still contain plenty of XML layouts, so in practice it helps to know them well enough to read and modify.

Why does entered text disappear when I rotate the screen?

A configuration change such as rotation destroys the Activity and creates it again. Screen state kept in a ViewModel survives configuration changes, and values that must be restored even after the process is killed use saved state.

When do I use an Activity and when a Fragment?

An Activity is a screen unit that serves as an entry point to the app, and a Fragment is a piece of UI that can be swapped or combined inside an Activity. A single Activity holding several screens switched by navigation is now the common structure, and with Compose screens are built from composable functions.

Next steps

This section covers Next steps from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.

If you have come this far, you have all the fundamentals for building and releasing an Android app from start to finish. Next, it is worth digging into Hilt (a cleaner code structure through dependency injection), Room (complex local databases), StateFlow (finer-grained ViewModel state management), and the Material 3 design system. Whenever you get stuck, come back to the sections of this guide to review.
← Previous guideKotlinNext guide β†’Flutter