PickMe Mar 29, 2025

Design Android build variants for Multi-Tenant

Article Summary

Piyal Madushanka from PickMe Engineering tackles a problem every scaling mobile team faces: how do you manage multiple regional apps without drowning in build configuration chaos?

When your Android app needs to serve different regions (tenants) with separate dev, staging, and production environments, the naive approach breaks down fast. This article presents a scalable architecture using Android's flavor dimensions to manage multi-tenant apps from a single codebase.

Key Takeaways

Critical Insight

By structuring product flavors with separate tenant and environment dimensions, you can scale from one app to dozens of regional variants without build script complexity spiraling out of control.

The article includes the exact Gradle configuration snippets that make this multi-dimensional flavor system work in practice.

About This Article

Problem

PickMe needed to generate multiple Android builds with unique application IDs and build-time configurations for different regions. They wanted to do this while keeping a single codebase, since managing separate codebases would become increasingly complex as they added more tenants.

Solution

Piyal Madushanka set up two flavor dimensions in the Android build script. One dimension handled tenants, and the other handled environments. This let each tenant have its own dev, staging, and production variants without needing to change environment configurations.

Impact

Adding new regions now just means creating new tenant flavors. The environment flavor logic stays untouched. This makes it possible to generate multi-tenant app variants from one repository for dozens of regional builds without extra work.