Android Developer
Updated for 2026: Android Developer interview questions and answers covering core skills, tools, and best practices for roles in the US, Europe & Canada.
Explain the Activity and Fragment lifecycle and common Android pitfalls.
Lifecycle events control when UI is created, resumed, paused, and destroyed. Pitfalls: - Doing heavy work on the main thread - Leaking contexts in singletons - Not handling configuration changes Best practice: move state into ViewModel, use lifecycle-aware components, and cancel work on stop/destroy to prevent leaks and crashes.
Jetpack Compose vs XML layouts: what are the trade-offs?
Compose is declarative and state-driven; XML is the traditional view system. Compose benefits: less boilerplate, faster UI iteration, easier theming. XML benefits: mature tooling, huge legacy ecosystem. Many teams adopt Compose gradually: new screens in Compose, existing screens in XML, with interoperability where needed.
How do Kotlin coroutines work and how do you avoid common coroutine bugs?
Coroutines provide structured concurrency for async work. Best practices: - Use the right scope (viewModelScope, lifecycleScope) - Cancel work on lifecycle events - Avoid blocking calls on Dispatchers.Main - Handle exceptions and supervision Interview tip: mention flows for streams and structured cancellation to prevent leaks.
How does dependency injection work on Android with Hilt and why use it?
Dependency injection reduces coupling and improves testability. Hilt provides: - Automatic component scopes - Easy ViewModel injection - Consistent setup across modules Use DI to swap implementations in tests, reduce boilerplate, and keep construction logic out of UI layers.
What is Room and how do you design a reliable local database layer on Android?
Room is an ORM on top of SQLite. Best practices: - Define entities/DAOs clearly - Use migrations for schema changes - Use transactions for multi-step writes - Avoid main-thread DB access Pair Room with an offline-first sync strategy when needed, using an outbox queue for local mutations.
WorkManager vs AlarmManager: which should you use for background work?
WorkManager is best for deferrable, guaranteed background work that should run even after app restarts. AlarmManager is better for exact timing use cases (rare) but is constrained by battery optimizations. Most apps should prefer WorkManager with constraints (network/charging) and idempotent workers with retries.
What is the Navigation Component and what problems does it solve?
Navigation Component standardizes navigation graphs, back stack behavior, and argument passing. Benefits: - Consistent back navigation - Type-safe arguments (with Safe Args) - Deep link support It reduces manual fragment transactions and makes navigation flows easier to reason about and test.
Android permissions: how should apps request them and avoid bad UX?
Ask permissions only when needed and after explaining value. Best practices: - Use runtime permissions correctly - Provide rationale when users deny - Offer alternative flows if denied - Avoid requesting multiple permissions at startup Also handle new OS versions (scoped storage, notification permission) and test across API levels.
How do Firebase Cloud Messaging (FCM) notifications work on Android?
FCM delivers push notifications using registration tokens. Flow: - App obtains FCM token - Server targets devices/topics with messages - App handles data messages for custom behavior Best practices: deep links, analytics for opens, notification channels, and respecting user preferences and quiet hours.
What are Doze and background execution limits, and how do they affect apps?
Android restricts background work to save battery. Doze and background limits can delay network access, jobs, and alarms. Design with: - WorkManager constraints - Foreground services only when justified - Retry/backoff logic Interview tip: show you understand that background scheduling is opportunistic and must be resilient.
How does the Android Gradle build system work and how do you speed up builds?
Gradle builds compile code, process resources, and package outputs. Speedups: - Enable Gradle build cache - Use configuration cache where supported - Avoid dynamic dependencies - Split modules and use incremental compilation Also keep dependencies lean and profile build scans to find slow tasks.
How do you test Android apps (unit tests, instrumentation, UI tests) effectively?
Use the testing pyramid. - Unit tests (JUnit) for logic - Instrumentation tests for Android components - UI tests (Espresso) for critical flows Keep UI tests minimal and stable with deterministic data and idling resources. Run tests in CI with emulator/device farms when needed.
How do you profile Android performance (CPU, memory, jank, ANRs)?
Start with metrics (startup, frame time, memory, ANR rate). Use: - Android Studio Profiler (CPU/memory) - Layout Inspector - Perfetto / Systrace for jank Fix the biggest bottleneck first: reduce main-thread work, optimize rendering, and remove memory leaks and excessive allocations.
How do you store secrets securely on Android (Keystore, encryption)?
Avoid plain text storage. Use: - Android Keystore to generate/store keys - EncryptedSharedPreferences or encrypted DB Also: - Prefer short-lived tokens - Avoid logging sensitive data - Use server-side revocation Security is end-to-end: storage + transport + backend validation.
How do Android App Links (deep links) work and how do you implement them?
App Links open your app for verified HTTPS domains. Implementation: - Add intent filters - Host assetlinks.json for verification - Route URLs safely in-app Validate parameters and enforce authentication for sensitive routes. Provide fallback behavior when content is unavailable.
APK vs Android App Bundle (AAB): what’s the difference?
APK is a single package; AAB lets Google Play generate optimized splits per device. Benefits of AAB: - Smaller downloads via splits (ABI, density, language) - Dynamic feature delivery For most apps, AAB is the recommended format for Play Store distribution.
What are common Google Play review issues and how do you avoid them?
Common issues include policy violations (privacy, permissions), broken flows, misleading metadata, and unsafe SDKs. Avoid by: - Following data safety requirements - Using permissions minimally - Testing across devices and API levels - Keeping SDKs updated Always review Play Console warnings and run pre-launch reports to catch crashes early.
How do you manage UI state on Android (ViewModel, LiveData, Flow)?
Move state out of Activities/Fragments into ViewModels. Use: - LiveData for lifecycle-aware updates - StateFlow/Flow for reactive streams Model UI state as a sealed class (Loading/Success/Error) to simplify rendering and avoid inconsistent UI. Keep side effects (navigation, toasts) separate from state updates.
How do you implement offline-first sync on Android with Room and WorkManager?
Offline-first uses local persistence plus background sync. Typical approach: - Store server data in Room - Track local mutations in an outbox table - Use WorkManager to sync with retries/backoff - Resolve conflicts deterministically Keep sync incremental and observable to debug stuck queues and data drift.
How do you avoid performance issues in Jetpack Compose (recomposition, state)?
Compose performance depends on stable state and minimizing unnecessary recompositions. Tips: - Use `remember` and stable data types - Avoid passing new lambdas/objects every recomposition - Use derivedStateOf for derived values - Profile with Layout Inspector and tracing Design composables to be small and stateless where possible.