From Fundamentals to Production: Kotlin, Compose, Architecture and Beyond
Introduction: Why Android 17 Matters
Who This Book Is For
What You Will Learn
How to Use This Book
Getting the Most Out of This Book
Chapter 1: The Android Platform - History, Architecture and Where We Are Today
From Android 1 to Android 17 - A Brief History
The Android Platform Architecture: HAL, Kernel, Runtime and Framework
- Linux Kernel
- Hardware Abstraction Layer (HAL)
- Android Runtime (ART)
- Native C/C++ Libraries
- Java API Framework
- System Applications
What Makes Android 17 Different: Key Themes and Design Philosophy
- Theme 1: Adaptive by Default
- Theme 2: Privacy Hardening
- Theme 3: Performance and Reliability
- Theme 4: Compose-First and the Intelligence System
The Android Open Source Project and the Release Cadence
Device Fragmentation in 2026 and API Level Targeting
- Understanding the Three API Level Attributes
- Google Play Requirements
- Choosing Your minSdk
- The Fragmentation Strategy
Chapter Summary
Exercises
Interview Questions
Chapter 2: Setting Up Your Development Environment
Installing Android Studio Rabbit
- Current Version: Android Studio Rabbit 2
- Toolchain Versions
- System Requirements
- Installation Steps
- First Launch Configuration
Configuring the Android 17 SDK and System Images
- Installing the Android 17 SDK Platform
- SDK Tools
- Configuring SDK Paths
- Verifying Your Installation
Emulator Setup: Hardware Acceleration, Virtual Devices and Cloud Testing
- Creating a Virtual Device
- Hardware Acceleration
- Emulator Performance Tips
- Essential Emulator Commands
- Cloud Testing Alternatives
Physical Device Configuration: USB Debugging, ADB and Fastboot
- Enabling Developer Options
- Connecting via USB
- ADB (Android Debug Bridge) Essentials
- Fastboot for Bootloader Operations
AI-Assisted Development Tools
Project Templates and Your First “Hello World”
- Creating a New Project
- Understanding the Project Structure
- The Empty Compose Activity Template
- Building and Running
- Troubleshooting Common Setup Issues
Chapter Summary
Exercises
Interview Questions
Chapter 3: Kotlin-First Development on Android
Why Kotlin Won: History, Adoption and Language Design
- The Android Adoption Story
- Why Kotlin Over Java for Android
Kotlin Fundamentals for Android: Types, Null Safety and Extension Functions
- Type System and Null Safety
- Smart Casts
- Data Classes
- Extension Functions
- When Expressions
- Scope Functions
Coroutines and Structured Concurrency on Android
- Understanding Coroutines
- Coroutine Scope and Lifecycle Awareness
- Dispatchers
- Structured Concurrency
- Coroutine Best Practices for Android
Kotlin Flow for Reactive Data Streams
- Creating and Collecting Flows
- Flow Operators
- StateFlow and SharedFlow
- Flow vs LiveData
Kotlin Multiplatform: Shared Business Logic
- What Can Be Shared
- What Remains Platform-Specific
- Basic KMP Project Structure
- When to Use KMP
Chapter Summary
Exercises
Interview Questions
Chapter 4: Modern App Architecture
The Evolution of Android Architecture: MVC to MVVM to MVI
- The Early Days: MVC and Code Behind
- MVP: The First Separation
- MVVM: Google’s Long-Standing Recommendation
- MVI: The Compose Era Contender
ViewModel, Repository and Use Case Patterns
- ViewModel: The State Holder
- Repository: The Data Mediator
- Use Cases: Single-Responsibility Actions
Dependency Injection: Hilt and Koin
- Hilt: Google’s Recommended DI Solution
- Koin: The Lightweight Alternative
- Hilt vs Koin Comparison
Navigation Component and Deep Linking
- Compose Navigation
- Navigation 3: The Compose-First Successor
- Deep Linking
Clean Architecture on Android 17
- Layer Responsibilities
- Module Boundaries
Chapter Summary
Exercises
Interview Questions
Chapter 5: Jetpack Compose - Declarative UI for Android
From XML Layouts to Compose: The Declarative Paradigm Shift
- The Imperative View System
- The Declarative Compose Approach
- Why Declarative?
Compose Fundamentals: Composables, State and Recomposition
- Writing Your First Composable
- State in Compose
- State Hoisting
- Recomposition
- Side Effects in Compose
Layouts, Modifiers and Custom Components
- Core Layout Composables
- Modifiers: Composable Configuration
- Lazy Lists: Efficient Scrolling
- Building Custom Components
Navigation in Compose: Single-Activity Architecture
- Bottom Navigation Pattern
Animations, Theming and Material Design 3
- Compose Animations
- Material Design 3 Theming
- Adaptive Layouts
Chapter Summary
Exercises
Interview Questions
Chapter 6: Android Views and Compose Interoperability
The View System: Layouts, Adapters and RecyclerView
- Core Layout Containers
- RecyclerView for Lists
Compose in Views: ComposeView and AndroidView
- Using Compose Inside an Activity or Fragment
- Compose in Fragments
- AndroidView: Embedding Views in Compose
Views in Compose: AndroidViewBinding
Incremental Migration Strategies
- Strategy 1: Compose Islands
- Strategy 2: Feature-by-Feature Migration
- Strategy 3: Bottom-Up Component Replacement
- Migration Checklist
When to Use Views vs Compose
Chapter Summary
Exercises
Interview Questions
Chapter 7: Lifecycle Management and Process Death
Activity Lifecycle: Creation, Resumption, Pausing and Destruction
- Lifecycle States
- The Critical Rule
Service Lifecycles: Foreground, Background and WorkManager
- Started Services
- Foreground Services
Configuration Changes and SavedStateHandle
- Surviving Configuration Changes
- Android 17’s Optimized Configuration Changes
Process Death and State Restoration
- Understanding Process Death
- Surviving Process Death
- State Restoration Strategy
Lifecycle-Aware Components and LifecycleOwner
- Lifecycle Observer Pattern
- collectAsStateWithLifecycle
Chapter Summary
Exercises
Interview Questions
Chapter 8: Permissions, Security and Privacy in Android 17
The Permission Model: Normal, Dangerous and Special Permissions
- Permission Categories
- Declaring Permissions in the Manifest
Runtime Permissions and Scoped Storage
- Requesting Dangerous Permissions
- Permission Groups
- Scoped Storage
Android 17 Privacy Enhancements: Photo Picker, Notification Permissions and More
- ACCESS_LOCAL_NETWORK Permission
- Android Contacts Picker
- OTP Protection for SMS Messages
- Encrypted Client Hello (ECH)
Security Best Practices: Keystore, Encryption and Network Security Config
- Android Keystore System
- Network Security Configuration
App Sandbox and Inter-Process Communication
- The Android Sandbox
- Content Providers for Safe Data Sharing
- Android 17 Security Changes
Chapter Summary
Exercises
Interview Questions
Chapter 9: Background Processing and Battery Optimization
Background Execution Limits and Android 17 Restrictions
- Android 17’s App Memory Limits
WorkManager: Deferrable, Guaranteed Background Work
- Basic Work Request
- Periodic Work
- Work Chains and Continuations
- Observing Work Status
Foreground Services and Foreground Service Types
- Declaring Foreground Service Types
- Foreground Service Types Available
- Android 17 Background Audio Hardening
JobScheduler and AlarmManager for Scheduled Tasks
- JobScheduler for Constraint-Based Work
- AlarmManager for Precise Timing
Battery Optimization: Doze Mode, App Standby and Power Profiles
- Doze Mode
- App Standby Buckets
- Power Optimization Best Practices
Chapter Summary
Exercises
Interview Questions
Chapter 10: Networking and Data Storage
HTTP Client Libraries: Retrofit, Ktor and OkHttp
- Retrofit: The Industry Standard
- Ktor Client: The Multiplatform Alternative
- OkHttp Interceptors for Cross-Cutting Concerns
JSON Serialization: Kotlinx Serialization and Moshi
- Kotlinx Serialization
- Moshi with Kotlin Codegen
Room Database: Entities, DAOs and Migrations
- Defining Entities
- DAO (Data Access Object)
- Database with Migrations
DataStore: Preferences and Proto-based Storage
- Preferences DataStore
- Proto DataStore
Caching Strategies and Offline-First Architecture
- Repository with Cache-Then-Network Pattern
- Offline-First Principles
Chapter Summary
Exercises
Interview Questions
Chapter 11: Media, Graphics and Sensors
CameraX and the Modern Camera API
- Android 17 Camera and Media Enhancements
Audio Playback: ExoPlayer, Media3 and AudioFocus
- Media3 ExoPlayer
- AudioFocus Management
Video Recording and Processing
- MediaRecorder for Video Capture
Skia, Canvas and Custom Drawing
- Custom Compose Drawings
- WebGPU for Managed Graphics Code
Sensor APIs: Accelerometer, Gyroscope, Location and Geofencing
- SensorManager for Device Sensors
- Location and Geofencing
Chapter Summary
Exercises
Interview Questions
Chapter 12: AI, On-Device ML and Android 17 Intelligent Features
TensorFlow Lite on Android: Model Loading and Inference
- Setting Up LiteRT
- Running Inference
MediaPipe Tasks: Vision, Audio and NLP
- Image Classification with MediaPipe
- Object Detection
Hardware Acceleration and the Android 17 NPU Gate
On-Device LLMs and Gemini SDK Integration
- MediaPipe LLM Inference API
- Gemini SDK for Android
Android 17: The Intelligence System - AppFunctions and Android MCP
Android 17 AI Features: Live Captions, Translation and Smart Compose
- Live Captions
- On-Device Translation
- Smart Compose and Predictive Text
Chapter Summary
Exercises
Interview Questions
Chapter 13: Performance Optimization and Profiling
Android Studio Profiler: CPU, Memory and Network
- CPU Profiler
- Memory Profiler
- Network Profiler
Frame Rendering and Jank Detection with Choreographer
- Understanding the Frame Pipeline
- Detecting Jank
- Reducing Jank in Compose
Memory Management: Leak Canary, Heap Analysis and Bitmap Optimization
- Common Memory Leak Patterns
- Heap Analysis in Android Studio
- Bitmap Optimization
Startup Time Optimization and Splash Screen API
- Measuring Startup Time
- Baseline Profiles
- Splash Screen API
Benchmark Library and Macro/Micro Benchmarks
- Macrobenchmarks: Measuring Real-World Performance
- Microbenchmarks: Measuring Individual Functions
Chapter Summary
Exercises
Interview Questions
Chapter 14: Accessibility and Internationalization
Accessibility Fundamentals: Content Descriptions and Touch Targets
- Content Descriptions
- Touch Target Sizes
TalkBack, Switch Access and Screen Magnification
- Testing with TalkBack
- Announcing Dynamic Content
- Switch Access
Dynamic Type and Scalable UI
- Material 3 Adaptive Typography
Internationalization: Locale, Number Formatting and Date/Time APIs
- String Resources with Plurals and Formatting
- Number and Date Formatting
- Per-App Language Settings (Android 13+)
Right-to-Left Layouts and Bidirectional Text
- RTL Support in Compose
- Testing RTL
Chapter Summary
Exercises
Interview Questions
Chapter 15: Testing on Android
Unit Testing with JUnit and MockK
- Setting Up the Test Environment
- Testing ViewModels
- Testing Repositories
Compose Testing: Semantics, Actions and Assertions
- Basic Compose Tests
- Semantics for Testing
Espresso and UI Automation
- Testing View-Based Screens
- Idling Resources for Async Operations
Continuous Integration and Cloud Testing (Firebase Test Lab)
- GitHub Actions CI Pipeline
- Firebase Test Lab
Chapter Summary
Exercises
Interview Questions
Chapter 16: Debugging, Crashes and Production Monitoring
Android Studio Debugger: Breakpoints, Stepping and Evaluate Expression
- Advanced Breakpoint Techniques
- Evaluate Expression
Logcat Mastery: Filtering, Tags and Remote Logging
- Structured Logging
- Logcat Filtering
Crash Reporting: Firebase Crashlytics and ACRA
- Firebase Crashlytics Setup
ANR Analysis and Main Thread Violations
- Understanding ANRs
- Detecting Main Thread Violations
- Android 17 New ProfilingManager Triggers for Production Debugging
Remote Configuration and Feature Flags
- Firebase Remote Config
Chapter Summary
Exercises
Interview Questions
Chapter 17: Publishing to the Play Store
App Signing: Upload Keys, Play App Signing and Bundletool
- Play App Signing
- Android 17 PQC APK Signing
Android App Bundles vs APKs
- Why App Bundles?
- Building an AAB
Play Console: Store Listing, Screenshots and Metadata
- Store Listing Optimization
- Content Rating and Data Safety
Release Tracks: Internal, Alpha, Beta and Production
- Phased Rollouts
Play Store Policies, Rating Requirements and Content Guidelines
- Key Policy Areas
- Common Rejection Reasons
Chapter Summary
Exercises
Interview Questions
Chapter 18: Migration Strategies and Backward Compatibility
API Level Targeting: minSdk, targetSdk and compileSdk
- The Three SDK Attributes Revisited
- Runtime API Checks
Deprecated APIs in Android 17 and Their Replacements
- Migration: Cleartext Traffic
- Migration: SMS OTP Reading
Build Configuration: Flavors, Dimensions and Dynamic Features
- Build Flavors
- Dynamic Feature Modules
Backward Compatibility Libraries: AndroidX and Jetpack
Migration Case Studies: From Android 12 to Android 17
- Case Study 1: Background Service Migration
- Case Study 2: Large Screen Adaptivity
- Case Study 3: Permission Migration
Chapter Summary
Conclusion: Building for the Future
- Key Takeaways
- What Comes Next
References