Skip to content

Top 30 Android Kotlin Interview Questions and Answers [2026]

October 9, 2026 14 min read
Android Kotlin interview guide by Second Talent
TL;DR: Android Kotlin interviews in 2026 test Jetpack Compose state and side effects, ViewModel and process death, lifecycle-aware coroutines, and release work such as R8 and Baseline Profiles. Google Play has required new apps and updates to target Android 16 (API level 36) since August 31, 2026, and Android 17 removes the opt-out from large-screen resizing for apps that target it.

Google declared Android UI "Compose First" at I/O in May 2026. View components such as RecyclerView and Fragments now get critical fixes only. Android 17 followed on June 15, 2026.

An Android interview today is a Compose interview, plus the lifecycle and process-death questions that never went away.

Key takeaways
  1. 1The Compose August '26 release (BOM 2026.08.00, Compose 1.12) compiles against API 37 and needs AGP 9.1.1 or later.
  2. 2Navigation 3, a back stack you own as a list, reached 1.0 on November 19, 2025; 1.2.0 is current.
  3. 3Google says Baseline Profiles speed up included code paths by about 30% from the first launch.
  4. 4From February 1, 2027, Play blocks updates that do not support 16 KB memory pages.

The questions below are about Android apps. For Kotlin the language, with null safety, sealed types, coroutine internals and backend frameworks, see our Kotlin interview questions.

Jetpack Compose

1. What triggers recomposition?

A composable re-runs when a State object it read during its last run changes. Compose records those reads. Writing to mutableStateOf re-runs only the composables that read it, and Compose skips children whose inputs did not change.

@Composable
fun Counter() {
    var count by remember { mutableStateOf(0) }
    Button(onClick = { count++ }) { Text("Clicked $count times") }
}

A plain var count = 0 would never recompose, and mutableStateOf without remember would reset to zero on every recomposition.

2. What is the difference between remember, retain and rememberSaveable?

They differ in how long the value lives, according to Google's page on state lifespans:

  • remember: survives recomposition only. Lost on rotation.
  • retain: also survives activity recreation and returns the same instance, but not process death. The value must not hold references that would leak the old activity.
  • rememberSaveable and rememberSerializable: survive process death by saving to the saved-instance bundle, so the value must be saveable. Right for text input, scroll position and toggles.

3. What is state hoisting?

Moving state out of a composable into its caller, and passing down the value and an event callback instead.

A stateless SearchField(query: String, onQueryChange: (String) -> Unit) can be previewed, tested and reused; one that owns its query cannot be controlled from outside.

Hoist state to the lowest common parent of every composable that reads or writes it. Screen-level state usually ends up in a ViewModel, which gives unidirectional data flow: state goes down, events go up.

4. When do you use LaunchedEffect, DisposableEffect, SideEffect and rememberCoroutineScope?

  • LaunchedEffect(key): run suspend work when the composable enters composition, restarting when the key changes, canceled when it leaves.
  • DisposableEffect(key): register and unregister something non-suspending, such as a listener, with cleanup in onDispose.
  • SideEffect: push Compose state to non-Compose code after every successful recomposition.
  • rememberCoroutineScope(): launch coroutines from event handlers such as onClick. The side-effects guide notes the scope is canceled when it leaves the composition.

Launching a coroutine directly in a composable body is the bug to watch for: it launches again on every recomposition.

5. What does stability mean in Compose, and what changed with strong skipping?

Compose skips a composable during recomposition when its parameters are equal to last time. Stable types, such as primitives and data classes of val stable fields, are compared with equals().

Unstable ones used to make the composable unskippable. A plain List is one; so is a class from a module without the Compose compiler.

Strong skipping, on by default since Kotlin 2.0.20 per the Compose docs, makes every restartable composable skippable. Unstable parameters are compared by instance (===), and lambdas with unstable captures are remembered automatically.

Stability still matters: a new list instance with the same contents now fails the check and recomposes.

6. Why do lazy lists need keys?

By default LazyColumn identifies items by position.

Insert an item at the top and row state, such as an expanded card, shifts to the wrong row. items(list, key = { it.id }) ties state to the item instead, and lets Modifier.animateItem() animate moves.

Senior candidates also mention contentType. It lets the list reuse slots between items of the same layout. That helps feeds that mix headers, ads and posts.

7. What is derivedStateOf for?

It turns a frequently changing state into a less frequent one, so readers recompose only when the derived result changes.

val showScrollToTop by remember {
    derivedStateOf { listState.firstVisibleItemIndex > 0 }
}

firstVisibleItemIndex changes on every scrolled row; the Boolean changes twice. Using derivedStateOf when the output changes as often as the input only adds overhead.

App Architecture

8. What does a ViewModel survive, and what does it not?

A ViewModel survives rotation and other config changes. The same instance keeps its data and running work. It does not survive process death, when the system kills a background app to free memory.

Table of what survives rotation and process death: the Activity is recreated, the ViewModel survives rotation but not process death, SavedStateHandle values are restored, and Room data stays on disk.

According to the saved state docs, SavedStateHandle values persist after the system kills the process. They do not survive the person swiping the app away or force-stopping it.

Test it, do not assume it. Turn on "Don't keep activities" in developer options, or put the app in the background and run adb shell am kill <package>. Then reopen it from Recents.

9. What belongs in SavedStateHandle, and what in the database?

Small UI state that comes from user input or navigation. Think of the search query, the selected tab, or the ID of the item being edited.

The saved-state bundle is size-limited and serialized on the main thread, so large lists and bitmaps do not belong there.

Anything the user would be upset to lose, such as a draft message, goes to Room or DataStore. After process death the ViewModel is recreated, reads the ID from SavedStateHandle, and reloads the rest from disk.

10. How should the UI collect state from a ViewModel?

Expose one StateFlow<UiState> per screen and collect it with collectAsStateWithLifecycle() from lifecycle-runtime-compose:

class ProfileViewModel(repo: ProfileRepository) : ViewModel() {
    val uiState: StateFlow<ProfileUiState> = repo.profile
        .map(ProfileUiState::Loaded)
        .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), ProfileUiState.Loading)
}

@Composable
fun ProfileRoute(vm: ProfileViewModel = hiltViewModel()) {
    val state by vm.uiState.collectAsStateWithLifecycle()
    ProfileScreen(state)
}

Plain collectAsState() keeps collecting while the app is in the background. WhileSubscribed(5_000) keeps the upstream alive for five seconds, long enough to survive a rotation without restarting the query.

11. How do you handle one-off events such as navigation or a snackbar?

Google's UI events guide says ViewModel events should always result in a UI state update. Instead of sending "navigate to home" through a channel, set isUserLoggedIn = true in the state.

The UI reacts by navigating, then tells the ViewModel it handled the event.

The reason is reliability. An event sent through a SharedFlow while nothing collects it, say during rotation, can be lost.

Many teams still use a Channel with receiveAsFlow(); a strong candidate knows the trade-off and which one their team chose.

12. How does Hilt provide dependencies to a ViewModel?

Annotate the Application with @HiltAndroidApp, entry points with @AndroidEntryPoint, and the ViewModel with @HiltViewModel plus an @Inject constructor.

Modules annotated @InstallIn(SingletonComponent::class) provide app-wide objects such as the Retrofit client and the Room database.

In Compose, hiltViewModel() returns a ViewModel scoped to the current navigation destination. The SavedStateHandle is injected automatically, including navigation arguments.

Scoping is the follow-up question: @Singleton for shared clients, and no scope for cheap stateless classes.

13. What does offline-first mean in practice?

The local database is the single source of truth. The UI observes Room through a Flow. The repository refreshes Room from the network in the background. The UI never renders network responses directly.

class ArticleRepository(private val dao: ArticleDao, private val api: Api) {
    val articles: Flow<List<Article>> = dao.observeAll()
    suspend fun refresh() = dao.upsertAll(api.fetchArticles())
}

Writes go to Room first, with a pending flag, and a WorkManager job syncs them when the network returns. Conflict resolution, such as last-write-wins or server timestamps, is where senior answers differ.

Coroutines and Background Work

14. Which coroutine scope should run which work?

Choose by how long the work must live. viewModelScope survives rotation and is canceled when the ViewModel is cleared. lifecycleScope is tied to an activity or fragment and ends when it is destroyed, including on rotation. rememberCoroutineScope ends when the composable leaves the screen.

Grid of coroutine scopes: viewModelScope survives rotation only, lifecycleScope and rememberCoroutineScope are canceled by rotation, leaving the screen and process death, and WorkManager survives all three.

Work that must finish even if the user leaves, such as uploading a photo, belongs in WorkManager. GlobalScope is the wrong answer: it leaks work nobody can cancel.

15. Why use repeatOnLifecycle instead of launchWhenStarted?

launchWhenStarted only suspended the coroutine when the lifecycle dropped below STARTED, so upstream flows kept producing into a paused collector.

It is deprecated. repeatOnLifecycle(Lifecycle.State.STARTED) cancels the collecting coroutine when the lifecycle drops below STARTED and starts it again on return.

lifecycleScope.launch {
    repeatOnLifecycle(Lifecycle.State.STARTED) {
        viewModel.uiState.collect { render(it) }
    }
}

In Compose, collectAsStateWithLifecycle() does this for you.

16. When is WorkManager the right tool?

For deferrable or guaranteed work that must survive the app leaving the screen. The WorkManager docs say scheduled work persists across app restarts and device reboots.

It supports constraints such as "unmetered network and charging", retries with backoff, chains of work, and periodic jobs with a 15-minute minimum interval.

Use setExpedited() for short, important work the user started, such as sending a message. For immediate work tied to what is on screen, a coroutine in viewModelScope is simpler.

17. What does main-safe mean?

A suspend function is main-safe when it can be called from the main thread without blocking it. It does its own thread switching with withContext(Dispatchers.IO) or Dispatchers.Default.

Room's suspend DAO functions and Retrofit's suspend interfaces are already main-safe, so wrapping them in another withContext(Dispatchers.IO) adds nothing. The switch belongs in the class that does the blocking work, often a data source.

Callers then never pick a dispatcher.

Performance and Release

18. What causes an ANR, and how do you find it?

The most common trigger is a main thread that does not respond to input within 5 seconds. That is from the Android vitals ANR page.

Others include a foreground service that does not call startForeground within 5 seconds and a slow BroadcastReceiver.

Causes include disk or network I/O on the main thread. Others are lock contention and heavy work in onCreate. Find them with StrictMode in debug builds, the ANR traces in Play Console, and system traces in Perfetto.

19. What are Baseline Profiles?

A list of classes and methods that Android compiles ahead of time at install. Without one, that code is interpreted and JIT-compiled on first use.

Google's overview puts the speed-up at about 30% from the first launch for the included code paths.

Generate them with the Baseline Profile Gradle plugin and a test that walks through startup and key journeys. Then measure with Macrobenchmark before and after.

Compose apps benefit most, because Compose ships as a library rather than as part of the OS.

20. What does R8 do, and what breaks when it is on?

R8 shrinks unused code and resources, obfuscates names and optimizes bytecode for release builds. It breaks code reached by reflection.

Common cases are JSON models parsed by reflection, classes named in XML or loaded by name, and some DI setups. Keep rules in proguard-rules.pro fix these, and many libraries ship their own consumer rules.

R8 also changes performance. Google reported in July 2026 that from AGP 9.2.0, R8 rewrites the atomic field updaters in kotlinx.coroutines. The result: launching and canceling coroutines up to 2 times faster.

21. How do you test Compose UI?

Use createComposeRule(), or createAndroidComposeRule when you need an activity. Find nodes through the semantics tree, then assert:

@get:Rule val rule = createComposeRule()

@Test fun showsError() {
    rule.setContent { LoginScreen(state = LoginUiState(errorMessage = "Wrong password")) }
    rule.onNodeWithText("Wrong password").assertIsDisplayed()
}

Because the screen takes state as a parameter, most tests need no ViewModel. Screenshot tests, through Compose Preview Screenshot Testing or third-party tools, catch visual regressions that assertions miss.

22. How does Kotlin Multiplatform share code with iOS?

Shared Kotlin code, usually the data and domain layers, compiles to JVM bytecode for Android and to a native framework for iOS. Platform-specific APIs are declared with expect in common code and implemented with actual per platform.

Libraries such as Ktor, SQLDelight and Room (which supports KMP) cover networking and storage.

UI can stay native on each side. Or it can be shared with Compose Multiplatform, which JetBrains declared stable for iOS in version 1.8.0 in May 2025.

Ask candidates how they exposed Kotlin coroutines and Flows to Swift, which is where KMP projects usually struggle.

23. How do you reduce app startup time?

Measure cold start with Macrobenchmark on a release build. Then defer setup. Many SDKs start themselves through content providers. The App Startup library, or lazy setup, moves them off the launch path.

Avoid disk reads in Application.onCreate, keep the first screen's layout simple, and ship a Baseline Profile.

The Play Console's Android vitals report startup times from real devices, which is where regressions on low-end phones show up.

What Changed Recently

Nov 19, 2025
Navigation 3 1.0 stable
May 19, 2026
Compose First: View components move to maintenance mode
Jun 15, 2026
Android 17 released, API level 37
Aug 11, 2026
Compose 1.12 (BOM 2026.08.00)
Aug 31, 2026
Google Play requires target API 36 for new apps and updates

24. What changes when an app targets Android 16?

Two behavior changes catch most apps, per the Android 16 behavior changes. Edge-to-edge can no longer be switched off. The windowOptOutEdgeToEdgeEnforcement attribute from Android 15 is disabled, so the app must handle window insets.

Predictive back animations are also on by default. onBackPressed is no longer called and KEYCODE_BACK is no longer sent, so custom back handling must move to OnBackPressedDispatcher or BackHandler.

Android 16 also ignores orientation and resize limits on displays at least 600dp wide for apps that target it. That release still had an opt-out.

25. What does Android 17 change for apps that target it?

According to Google's Android 17 announcement, apps targeting API level 37 lose the opt-out for orientation and resizability restrictions on large screens.

The system ignores screenOrientation, setRequestedOrientation(), resizeableActivity="false" and aspect-ratio limits there. Games are exempt.

The same release stops recreating activities for config changes that need no full redraw. Examples are keyboard, touchscreen and color-mode changes.

Those now arrive in onConfigurationChanged(), and an app that depends on the old restart must opt in with android:recreateOnConfigChanges.

26. Which Google Play requirements apply in 2026?

Since August 31, 2026, new apps and updates must target Android 16 (API level 36). Existing apps must target at least Android 15 to stay visible to new users on newer devices. That is Google's target API level policy.

Developers can request an extension to November 1, 2026.

Apps with native code must also support 16 KB memory pages. The page-size guide says that from February 1, 2027, Play will block updates that do not.

Every .so file in the app, including ones inside third-party SDKs, must be built with 16 KB alignment.

27. What does "Compose First" mean for a codebase with Views?

Google's May 2026 announcement put View components in maintenance mode. That includes View-based libraries such as Fragments, RecyclerView and ViewPager. They get critical bug fixes and no new features.

Google says it has no plans to deprecate or remove them. New Android Studio UI tools will be Compose-only.

Google's advice is to build new features in Compose and convert existing ones when you touch them. ComposeView puts Compose inside a View hierarchy and AndroidView does the reverse, which is how most apps migrate screen by screen.

28. How is Navigation 3 different from Navigation Compose?

In Navigation 3, the back stack is a list you own, such as a SnapshotStateList of keys. You navigate by adding or removing items. NavDisplay renders whatever the list contains and animates changes.

Navigation Compose kept the back stack inside a NavController and exposed it through routes.

The Navigation 3 guide also lists scenes that show several destinations at once. They suit list-detail layouts on the large screens Android 17 now makes apps support.

Navigation Compose
  • Back stack lives in NavController
  • You navigate by route
  • One destination on screen at a time
Navigation 3
  • Back stack is a list you own
  • You navigate by adding and removing keys
  • Scenes can show several destinations

29. What changed in Android Gradle Plugin 9?

Two things most projects hit, per the AGP 9.0 release notes. Kotlin support is built in and on by default. Modules no longer apply org.jetbrains.kotlin.android, which does not work with the new DSL.

And AGP uses only the new public DSL and Variant API: applicationVariants and similar old APIs are gone, replaced by androidComponents.

Kotlin Multiplatform modules move to the Android Gradle Library Plugin for KMP. Third-party Gradle plugins that relied on the old internals need updates, which is usually what blocks an upgrade.

30. What arrived in the Compose August '26 release?

Compose 1.12, per the release post. It compiles against API 37 and requires AGP 9.1.1. Modifier.onFirstVisible() is deprecated in favor of onVisibilityChanged().

Mesh gradients and wide color gamut rendering arrive, and a keyed SideEffect overload fires a one-shot effect when its keys change.

Google measured the keyed SideEffect at up to 90% faster than LaunchedEffect. Use it when you need neither a coroutine nor cleanup. It runs before DisposableEffect and LaunchedEffect, so migrating existing effects needs care.

Signs of a Strong Answer

  • They test process death as a matter of course and know which state survives it.
  • They explain a recomposition problem with stability and the Layout Inspector's recomposition counts, not guesses.
  • They pick a coroutine scope by the work's required lifetime and move anything that must finish into WorkManager.
  • They model ViewModel events as state and can defend the choice if their team used a Channel.
  • They know their app's target SDK, what the next one changes, and the Play deadline.
  • They measure startup with Macrobenchmark and ship a Baseline Profile.

Hiring Android Developers

Second Talent places pre-vetted Android developers from Asia who build with Kotlin and Compose, screened with questions like these. See what an Android developer costs or a Kotlin developer costs by country.

Tell us about the app and we send a shortlist.

Ready to hire? Hire Android Developers: vetted AI-native talent, with first profiles in 24 hours.

Get developers who ship with AI agents. Starts at $25/Hour.

Start Hiring $0 cost until you hire