Advanced interview questions in Android & Kotlin, page 2

Implement a type-safe DSL in Kotlin for a UI component
Tests understanding of Kotlin's type-safe builders via lambdas with receivers. A great answer defines model classes, creates a top-level builder function taking a Receiver.() -> Unit lambda, and defines nested builder methods.

Explain the difference between Gradle build types and product flavors.
If you know build types are how an app is built—debug versus release—while flavors are what is shipped, like free versus paid. Variants are the Cartesian product.

Explain Gradle Build Types vs. Product Flavors
Tests your grasp of Gradle's build matrix. A great answer defines build types for lifecycle (debug/release) and product flavors for user-facing versions (free/paid), then explains how they combine into variants.

Gradle Build Types vs. Product Flavors
This tests your understanding of Gradle's build matrix for creating different app versions. A great answer defines build types (how it's built) vs. flavors (what is built) and explains that variants are the cross-product. A red flag is confusing their roles.

Which Android Studio Profiler tool diagnoses high memory usage and leaks?
Heap dump, check retained size for leaked Activities, trace reference chains to root retainer.

How do you diagnose a memory leak using the Android Studio Profiler?
This tests your practical skill with the Android Memory Profiler, not just theory. A great answer involves capturing a heap dump, filtering for unreachable objects, and inspecting the reference tree to find the leak's source.

How do you diagnose a memory leak with Android Studio Profiler?
This tests your systematic process for debugging memory issues. A good answer outlines using the Memory Profiler, forcing GC, capturing heap dumps, and analyzing object references. A red flag is just naming the tool without explaining the 'how'.
How do you manage API keys across Gradle build variants securely?
Gitignore a properties file, load it in build.gradle, map secrets to BuildConfig or manifest placeholders by flavor, and commit safe defaults.
Managing Sensitive Information in Gradle Builds
Tests secure credential handling in Android builds. A good answer uses a git-ignored .properties file, the secrets-gradle-plugin to parse it, and accesses keys via BuildConfig. A red flag is storing keys directly in build.gradle or committing them.
How would you manage API keys in Gradle without version control?
Tests secure credential handling in Android builds. A good answer proposes the Secrets Gradle Plugin, which reads from an untracked properties file and exposes keys via BuildConfig, while also noting this doesn't protect against APK decompilation.

Your app is killed for memory; what runs when the user returns?
Tests process death versus config change. Answer: no callback on kill; return runs onCreate with savedInstanceState, onStart, and onResume. ViewModels die in process death; use SavedStateHandle. Red flag: claiming onDestroy fires or ViewModels survive it.

Explain app restoration after Android process death
Tests your grasp of process death vs. configuration changes. A good answer explains that the entire app process is recreated, starting with onCreate, and state must be restored from the SavedStateHandle.

Handle Android Process Death vs. Configuration Changes
Tests your grasp of Android's lifecycle for state restoration. A good answer explains that onCreate(savedInstanceState) is called in both cases, but process death recreates everything. Use ViewModel with SavedStateHandle.

What happens to a bound service during config changes and multiple clients?
Tests bound service reference counting. Config change destroys the Activity binding; if no other clients exist, the service stops. Multiple clients keep it alive until the last unbind. Red flag: assuming the service survives config changes without a rebind.

Bound Service Lifecycle with Config Changes & Multiple Clients
Tests your grasp of bound Service lifecycles. Explain that with BIND_AUTO_CREATE, the Service survives an Activity's config change recreation. It's only destroyed after the *last* client unbinds. A red flag is assuming the Service dies with the first client.

Bound Service Lifecycle: Config Changes and Multiple Clients
Tests deep knowledge of bound service lifecycles. A config change causes an unbind/rebind cycle, recreating the service. With multiple clients, the service isn't destroyed until the last one unbinds. Red flag: assuming the service survives the config change.
How does Android manage ContentProvider lifecycle and threading across processes?
Tests Android IPC and provider architecture. Strong answers explain lazy per-process instantiation via AMS, ContentResolver as the client binder proxy, and query executing on a binder thread. Red flag: claiming the provider runs in the caller process.
ContentProvider Lifecycle During Cross-Process Queries
Tests knowledge of Android's IPC, process management, and threading for ContentProviders. The ContentResolver asks AMS to find/start the provider's process. The provider's onCreate() runs on the main thread, but the query() itself runs on a binder thread.
How does Android manage a ContentProvider's lifecycle during a query?
This tests your understanding of Android IPC and component lifecycles. Explain how ContentResolver uses a URI to have the system instantiate the provider in its own process.

Difference between remember and rememberSaveable
Remember survives recompositions only; rememberSaveable uses Bundle state for config changes and process death; use for UI state after recreation.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles