One Gradle Build for 53 Offline Android Apps
Summary
Pixel’s announcement explores how 53 single-purpose Android apps share one Gradle build, including reusable billing, UI, and lunar core modules. It also covers convention plugins, a centralized app list, and checks that help keep listings and releases consistent as the collection grows.
DEV Community
One Gradle build, 53 offline Android apps: what lives in the shared core
AI disclosure: this post was drafted with an AI assistant from our own repository and checked against it before posting. #ABotWroteThis We make small single-purpose Android apps: a practice log for musicians, a pantry expiry list, a "where did I put it" finder, and so on. They now live in one Gradle build: 53 app modules (not all of them are on the store yet). This post is about the parts that made that manageable — what we pulled into shared code, what we kept per app, and the checks that run before anything is uploaded. The layout settings.gradle.kts has one list of app names. Each app keeps its own folder (/app), but the Gradle project is named after the app: listOf("constella", "sotto", "verso", / … / "lessico").forEach { app ->
include(":$app")
project(":$app").projectDir = file("$app/app")
}
// Code that is the same in every app lives once, here.
listOf("billing", "ui", "lunar").forEach { m ->
include(":core:$m")
project(":core:$m").projectDir = file("core/$m")
}
Having the list in one place turned out to matter beyond Gradle. Our store-listing checker reads the same list with a regex instead of keeping its own copy — a hand-kept copy once missed two newly added apps. Convention plugins instead of copied build files build-logic/ is an included build with three precompiled script plugins: constella.android-app — compile/target SDK, the language list, release shrinking, signing from an untracked keystore.properties, Compose, the test setup, and the dependencies every app uses (including :core:ui and :core:billing) constella.android-library — the same basics for the core modules constella.room — for apps that keep their data in Room An app's own build.gradle.kts then only says what is different about it. A whole one looks like this: plugins {
id("constella.android-app")
id("constella.room")
}
android {
namespace = "io.constella.spartito"
defaultConfig {
applicationId = "app.constella.spartito"
versionCode = 4
versionName = "1.0.3"
}
}
When we change the SDK level, the shrinker rules, or the test settings, it is one edit for every app in the build. One flag for a free edition Billing lives in :core:billing, which has two source sets with the same API: src/play (Play Billing) and src/free (no-op). A Gradle property picks one: val billing = providers.gradleProperty("constella.billing").orNull != "false"
android {
sourceSets["main"].java.srcDir(if (billing) "src/play/java" else "src/free/java")
}
dependencies {
if (billing) implementation(libs.billing.ktx)
}
With -Pconstella.billing=false the Billing library, and with it the billing permission, is not in the build at all. The app code does not change. No network permission None of the apps asks for INTERNET — not in the source manifests, and not in the merged release manifests either, which is where a library could have slipped it in. Most say why in a comment: no account, no sync, nothing to send. Backup is a file the user exports (ZIP or JSON, depending on the app), so there is no server side to run either. Store listings are checked like code Each app has store/listing_.md for 18 languages, plus its icon, feature graphic and screenshots. Before anything is uploaded, check_store.py walks every app in the settings list and fails the build if: a listing file is missing, or the title, short description or full description is empty or over Play's limits (30 / 80 / 4000 characters) the icon is not 512 × 512 or the feature graphic is not 1024 × 500 there are fewer than 2 or more than 8 screenshots for a language, or one breaks the size rules (shortest side at least 320 px, longest at most 3840 px, at most 2:1, under 8 MB) It reads PNG sizes straight from the file header, so it needs no image library and no network. Apps that launch in fewer languages on purpose are named in the script, with the reason next to the name. CI runs the same checks every time .github/workflows/ci.yml runs, in orde...

Powered by Readybot.io