Technology

Android Interview Questions and Answers

Android developer interviews test Kotlin, the Android framework and modern app architecture. These Android interview questions cover activities, fragments, intents and the lifecycle for freshers, then Jetpack Compose, ViewModel, coroutines, Room, dependency injection, background work and performance for experienced Android developers.

30 questions · Updated

Reading answers is not the same as saying them.Practise Android questions out loud and get a score, what you missed and a model answer for each one.
Practise free with AI
Android Interview Questions with answers. Examples: What are the main components of an Android app? Explain the activity lifecycle. What is an intent? What is a ViewModel, and why use it?
Android Interview Questions: 30 questions with model answers on this page.

Basic Android interview questions

Fundamentals, definitions and simple scenarios. Good for freshers and warm-ups.

1. What are the main components of an Android app?

Activities (screens with a user interface), services (work in the background without a UI), broadcast receivers (respond to system or app events such as low battery or connectivity changes) and content providers (share data between apps). They are declared in AndroidManifest.xml along with permissions.

2. Explain the activity lifecycle.

onCreate initialises the activity and sets up the UI, onStart makes it visible, onResume makes it interactive in the foreground, onPause runs when it loses focus, onStop when it is no longer visible, and onDestroy before it is destroyed. Configuration changes such as rotation destroy and recreate the activity by default, which is why state is kept in a ViewModel.

3. What is an intent?

Answer flow · 3 steps
  1. An intent is a message used to start components or communicate between them.

  2. An explicit intent names the exact component, such as starting a specific activity in your app.

  3. An implicit intent describes an action, such as ACTION_VIEW or ACTION_SEND, and lets the system find an app that can handle it, such as opening a link or sharing text.

4. Why is Kotlin preferred over Java for Android?

Answer flow · 3 steps
  1. Google declared Android Kotlin-first.

  2. Kotlin is concise, has null safety built into the type system (which prevents many crashes), data classes, extension functions, coroutines for asynchronous code, and is required for Jetpack Compose.

  3. It interoperates fully with Java, so existing Java code and libraries still work.

5. What is a fragment, and what is its lifecycle?

Answer flow · 3 steps
  1. A fragment is a reusable part of an activity's UI with its own lifecycle, used for screens in single-activity apps with the Navigation component.

  2. Its callbacks include onCreate, onCreateView (inflate the layout), onViewCreated (set up views and observers), onStart, onResume, onPause, onStop, onDestroyView (clear view references) and onDestroy.

  3. The view lifecycle is shorter than the fragment's, which causes leaks if views are kept.

6. What is AndroidManifest.xml?

The manifest describes the app to the system: its package name, components (activities, services, receivers and providers) with intent filters, the launcher activity, permissions it needs, hardware features it uses, the theme and settings such as backup rules. Each library's manifest is merged into the final one at build time.

7. How do runtime permissions work?

Answer flow · 3 steps
  1. Dangerous permissions, such as camera, location, contacts and notifications on Android 13+, must be requested at runtime as well as declared in the manifest.

  2. Check with ContextCompat.checkSelfPermission, request with the Activity Result API (rememberLauncherForActivityResult in Compose), explain why when shouldShowRequestPermissionRationale is true, and handle denial gracefully.

  3. Request permissions only when the feature is used.

8. How does RecyclerView work?

Answer flow · 3 steps
  1. RecyclerView displays long lists efficiently by creating only enough item views to fill the screen and recycling them as the user scrolls.

  2. An Adapter binds data to ViewHolders, a LayoutManager arranges them in a list or grid, and ListAdapter with DiffUtil calculates minimal updates when data changes.

  3. In Compose, LazyColumn and LazyRow replace it.

9. How are Android resources organised?

Answer flow · 3 steps
  1. Resources live in res folders such as values (strings, colours, dimensions, themes), drawable, mipmap (launcher icons) and font.

  2. Qualifiers provide alternatives automatically chosen by the device, such as values-hi for Hindi translations, values-night for dark theme, and layout-sw600dp for tablets.

  3. Strings should never be hard-coded so the app can be translated.

10. What are Gradle build types and product flavours?

Answer flow · 5 steps
  1. Gradle builds the app.

  2. Build types such as debug and release control settings like minification, debugging and signing.

  3. Product flavours create versions of the app, such as free and paid or staging and production, with different application IDs, API URLs or resources.

  4. Each combination is a build variant.

  5. Configuration is usually written in Kotlin DSL (build.gradle.kts) with a version catalog.

11. What is the difference between an APK and an AAB?

An APK is the installable package containing the code and resources for all devices. An Android App Bundle (AAB) is the publishing format required by Google Play; Play uses it to generate optimised APKs for each device, with only the needed languages, screen densities and CPU architecture, which makes downloads smaller.

Intermediate Android interview questions

Applied problems, trade-offs and questions about your own projects.

12. What is a ViewModel, and why use it?

Answer flow · 3 steps
  1. A ViewModel holds and manages UI-related data in a lifecycle-aware way.

  2. It survives configuration changes such as screen rotation, so data is not reloaded, and it separates business logic from the UI.

  3. It exposes state through StateFlow or LiveData, and its viewModelScope cancels coroutines automatically when the ViewModel is cleared.

13. What is Jetpack Compose?

Jetpack Compose is Android's modern declarative UI toolkit. Instead of XML layouts, you write composable functions in Kotlin that describe the UI for the current state, and Compose recomposes the parts that change when state changes. remember and mutableStateOf hold state, state hoisting keeps composables reusable, and it greatly reduces UI code.

14. What are Kotlin coroutines, and how are they used in Android?

Answer flow · 3 steps
  1. Coroutines are lightweight threads for writing asynchronous code sequentially using suspend functions.

  2. In Android they run network and database work off the main thread with Dispatchers.IO and return results to the UI with Dispatchers.Main.

  3. Structured concurrency through viewModelScope and lifecycleScope cancels work automatically, and Flow handles streams of data.

15. What is Room?

Answer flow · 3 steps
  1. Room is Jetpack's persistence library on top of SQLite.

  2. You define entities as data classes, DAOs with SQL queries checked at compile time, and a database class.

  3. It supports suspend functions and Flow for reactive queries, migrations for schema changes, and is the recommended way to store structured data locally for offline support.

16. How do you make network calls with Retrofit?

Define an interface with annotated suspend functions such as @GET("users/{id}") suspend fun getUser(@Path("id") id: String): User, build a Retrofit instance with a base URL and a converter (kotlinx.serialization or Moshi), and call it from a repository on Dispatchers.IO. OkHttp underneath handles connection pooling, caching, timeouts and interceptors for logging and authentication headers.

17. What is Hilt?

Answer flow · 3 steps
  1. Hilt is Android's recommended dependency injection library, built on Dagger.

  2. You annotate the Application with @HiltAndroidApp, activities and fragments with @AndroidEntryPoint, ViewModels with @HiltViewModel, and provide dependencies through @Inject constructors or @Module classes with @Provides and @Binds, scoped to components such as Singleton or ViewModel.

  3. It makes classes testable and wiring automatic.

18. How does navigation work in modern Android apps?

Answer flow · 3 steps
  1. Most apps use a single activity with the Navigation component.

  2. In Compose, a NavHost defines destinations, and a NavController navigates between them with type-safe routes defined as serializable classes, supporting arguments, deep links, nested graphs and the back stack.

  3. Navigation 3 is a newer Compose-first library where the app owns the back stack directly.

19. What is the difference between LiveData, StateFlow and SharedFlow?

Answer flow · 3 steps
  1. LiveData is lifecycle-aware observable data from the older Architecture Components.

  2. StateFlow is a Kotlin Flow that always holds a current value, like LiveData, and is the modern choice for UI state, collected with collectAsStateWithLifecycle in Compose or repeatOnLifecycle in views.

  3. SharedFlow has no current value and suits one-off events such as showing a message.

20. Why use DataStore instead of SharedPreferences?

Answer flow · 4 steps
  1. SharedPreferences has a synchronous API that can block the main thread, no proper error handling and no transactional safety.

  2. DataStore uses coroutines and Flow, handles errors and updates data safely.

  3. Preferences DataStore stores key-value pairs, and Proto DataStore stores typed objects.

  4. Structured data still belongs in Room.

21. How do state and side effects work in Compose?

Answer flow · 3 steps
  1. remember keeps a value across recompositions, rememberSaveable also survives configuration changes and process death, and mutableStateOf triggers recomposition when changed.

  2. State should usually be hoisted to the caller or a ViewModel.

  3. Side effects use effect handlers: LaunchedEffect runs suspend work tied to keys, DisposableEffect cleans up, and rememberCoroutineScope launches coroutines from events.

22. How do you handle configuration changes and process death?

Answer flow · 3 steps
  1. A ViewModel survives configuration changes such as rotation, but not process death, when Android kills the app in the background to reclaim memory.

  2. SavedStateHandle in the ViewModel and rememberSaveable in Compose store small UI state, such as form input or a selected tab, that is restored when the user returns.

  3. Larger data is reloaded from the database or network.

High level Android interview questions

System design, deep internals, leadership and tough follow-ups.

23. Explain MVVM and clean architecture in Android.

Answer flow · 3 steps
  1. In MVVM, the View (activity, fragment or composable) observes state from a ViewModel, which gets data from repositories.

  2. Google's recommended architecture adds a UI layer, an optional domain layer with use cases, and a data layer with repositories combining remote (Retrofit) and local (Room) sources.

  3. Unidirectional data flow, where events go up and state comes down, makes the app predictable and testable.

24. How do you run background work reliably in Android?

Answer flow · 4 steps
  1. For deferrable work that must complete even if the app closes or the device restarts, such as uploads or sync, I use WorkManager with constraints such as network or charging.

  2. For work while the user is in the app, coroutines in viewModelScope.

  3. For ongoing user-visible tasks such as music playback or navigation, a foreground service with a notification.

  4. Android restricts background execution to save battery.

25. How do you find and fix performance problems in an Android app?

I use Android Studio profilers for CPU, memory and network, LeakCanary for memory leaks, and Baseline Profiles and Macrobenchmark for startup time. Common fixes are moving work off the main thread to avoid ANRs, reducing overdraw and recompositions in Compose, loading and caching images efficiently with Coil or Glide, paging large lists, and reducing app size with R8.

26. How do you secure an Android app?

Use HTTPS only through a network security configuration, consider certificate pinning for sensitive apps, store tokens with the Android Keystore (EncryptedSharedPreferences is deprecated, so use Keystore-backed encryption), never hard-code secrets in the app, enable R8 to shrink and obfuscate code, avoid exporting components unnecessarily, validate intents, use the Play Integrity API to detect tampered devices and keep dependencies updated.

27. Why modularise an Android app, and how?

Answer flow · 3 steps
  1. Splitting a large app into Gradle modules speeds up builds through parallel and incremental compilation, enforces clear boundaries, and lets teams work independently.

  2. A common structure has an app module, feature modules (such as feature:login), and core modules (core:data, core:ui, core:network).

  3. Convention plugins share build logic, and feature modules depend on core modules, not on each other.

28. How do you test an Android app?

Answer flow · 4 steps
  1. Local unit tests with JUnit and MockK or fakes cover ViewModels, use cases and repositories, using kotlinx-coroutines-test for coroutines and Turbine for Flows.

  2. Robolectric runs Android framework code on the JVM.

  3. Instrumented UI tests use Compose testing APIs or Espresso on devices or emulators, and screenshot tests catch visual regressions.

  4. Hilt provides test doubles.

29. How would you build an offline-first Android app?

Answer flow · 3 steps
  1. Make the local Room database the single source of truth: the UI observes it with Flow, so it works without a connection.

  2. Repositories fetch from the network and update the database, and user changes are saved locally first and then synced to the server with WorkManager when connectivity returns, with conflict handling such as timestamps or server rules.

  3. Paging 3 with RemoteMediator handles large lists.

30. How do you release an app on Google Play?

Build a signed AAB with Play App Signing, test it on the internal, closed and open testing tracks, complete the store listing, content rating and data safety form, then release to production with a staged rollout starting at a small percentage while watching Android vitals, crashes and ANRs. New personal developer accounts must run a closed test with testers before production access.

Ready to test yourself?Pick your topics and level, answer by voice or text, and get instant feedback. Free.
Start a mock interview

Preparing for a mobile app developer interview?

See all Mobile App Developer interview questions, covering Android, Kotlin, iOS, Swift, SwiftUI and more.

Related skill interview questions

More technology interview questions

HR round, company and bank interview questions

Bank and government exams

Interview questions for other fields