Android Project Build and Release
Metadata:
- Covers: settings.gradle.kts, build.gradle.kts,
gradle.properties,gradle/**,gradlew,gradlew.bat,buildSrc/**, app/build.gradle.kts,app/proguard-rules.pro, color/build.gradle.kts,color/proguard-rules.pro,fastlane/**,.github/workflows/**
Overview
This is a Gradle Kotlin DSL Android project with two included modules: :app and :color, declared in settings.gradle.kts. Repository resolution is centralized there with RepositoriesMode.FAIL_ON_PROJECT_REPOS, so modules are expected to use google(), mavenCentral(), and mavenLocal() from the settings-level configuration rather than adding their own repositories.
Root build configuration is intentionally thin. build.gradle.kts registers Android, Kotlin, KSP, Compose compiler, Room, and ktfmt plugins from the version catalog without applying them globally, then exposes a root clean task. Dependency and plugin versions live in gradle/libs.versions.toml; app and library modules consume aliases and bundles from that catalog. Gradle itself is pinned by gradle/wrapper/gradle-wrapper.properties to Gradle 8.10.2, while gradlew and gradlew.bat bootstrap the wrapper from gradle/wrapper/gradle-wrapper.jar for Unix and Windows callers.
Project-wide Gradle switches are in gradle.properties: AndroidX is enabled, Kotlin uses official style, non-transitive and non-final Android resources are enabled, configuration cache is enabled, and ABI_FILTERS=arm64-v8a is the default ABI list used when APK splits are disabled. The build uses Java/Kotlin toolchain 21 in buildSrc/build.gradle.kts, app/build.gradle.kts, and color/build.gradle.kts; GitHub Actions also install JDK 21 before invoking Gradle.
buildSrc/…/Version.kt is the release version source used by app/build.gradle.kts. It models alpha, beta, release-candidate, and stable versions, deriving both a string name and numeric code; currentVersion currently points at Version.Alpha(2, 0, 0, 5). In app/build.gradle.kts, baseVersionName and currentVersionCode come from this object, and defaultConfig.versionCode is checked against currentVersionCode during configuration.
The app module in app/build.gradle.kts is the main Android application. It compiles and targets SDK 35, has package namespace/application id com.junkfood.seal, supports minSdk 24, enables generated BuildConfig, Room schema output under app/schemas, KSP incremental Room processing, Compose, Kotlin serialization, and ktfmt formatting. Release builds enable minification and resource shrinking and use app/proguard-rules.pro; debug builds add .debug and -debug suffixes and set the app name to Seal Debug. If a root keystore.properties file exists, both debug and release builds create and use a githubPublish signing config from that file.
APK distribution is flavor- and ABI-aware in app/build.gradle.kts. The single flavor dimension is publishChannel with generic as default, githubPreview adding .preview and the Seal Preview app name, and fdroid appending -(F-Droid) to the version name. By default splitApks is true unless Gradle is run with -PnoSplits; split builds generate APKs for arm64-v8a, armeabi-v7a, x86, x86_64, and a universal APK. When splits are disabled, the build restricts native ABIs from ABI_FILTERS. Variant outputs add ABI-specific offsets to version codes and are named Seal-${defaultConfig.versionName}-${name}.apk.
app/proguard-rules.pro keeps yt-dlp/commons-compress classes and Kotlin serialization runtime access while disabling obfuscation. The :color Android library in color/build.gradle.kts compiles SDK 34 with minSdk 21, namespace com.junkfood.seal.color, Compose compiler support, Java 8 compile options, release minification, and API exposure of Compose/Core dependencies from the catalog. Its color/proguard-rules.pro keeps Monet/HCT implementation packages and suppresses StringConcatFactory warnings.
CI and release automation live under .github/workflows. .github/…/android_ci.yml runs on pull requests to main, checks out the repo, installs JDK 21 and the Android SDK, sets up Gradle caching, makes gradlew executable, and runs ./gradlew buildGenericRelease. .github/…/android.yml is a manual release APK workflow: it installs JDK 21 and Android SDK, runs gradle assembleRelease, signs APKs from app/build/outputs/apk/release with repository secrets, and uploads only *-arm64-v8a-release-signed.apk as the signed-apks artifact. The remaining workflows are repository maintenance: .github/…/Issue-Handler.yaml closes newly opened issues matching hard-coded keywords and labels, .github/…/close-stale-issues.yml marks inactive issues/PRs stale monthly, and .github/…/sponsor.yml regenerates sponsor content in README.md on schedule or manual dispatch.
Play/F-Droid-style store listing assets are under fastlane/metadata/android. Locale directories such as en-US, de-DE, zh-TW, and others contain title.txt, short_description.txt, full_description.txt, optional localized changelogs/<versionCode>.txt, and for en-US image assets including screenshots and icon.png. These files are distribution metadata rather than Gradle inputs, but changes here belong with build/release documentation because they affect published release presentation.
Coupling
- If buildSrc/…/Version.kt changes
currentVersionor the version-code formula, also update app/build.gradle.ktsdefaultConfig.versionCode; configuration fails because app/build.gradle.kts checksversionCode == currentVersionCode. - If ABI names, split behavior, or
ABI_FILTERSchange in app/build.gradle.kts orgradle.properties, also update .github/…/android.yml; the release workflow only uploadsapp/build/outputs/apk/release/*-arm64-v8a-release-signed.apkand will fail withif-no-files-found: errorif output naming or ABI selection changes. - If flavors are renamed or removed in app/build.gradle.kts, also update .github/…/android_ci.yml; CI invokes the generated
buildGenericReleasetask, which depends on thegenericflavor andreleasebuild type existing. - If Java/Kotlin toolchains change in buildSrc/build.gradle.kts, app/build.gradle.kts, or color/build.gradle.kts, also change the JDK setup in .github/…/android_ci.yml and .github/…/android.yml; both workflows currently install Temurin 21.
- If plugin or dependency aliases are renamed in gradle/libs.versions.toml, update all module build scripts that consume them (build.gradle.kts, app/build.gradle.kts, and color/build.gradle.kts) because the project relies on catalog aliases rather than literal coordinates in module files.
- If release minification rules change in
app/proguard-rules.proorcolor/proguard-rules.pro, verify the correspondingreleasebuild types in app/build.gradle.kts and color/build.gradle.kts; both modules enable minification for release and load these project-specific rule files. - If localized release changelog filenames under
fastlane/metadata/android/**/changelogs/are added for a new version, ensure their numeric filename matches the published app version code scheme from buildSrc/…/Version.kt and app/build.gradle.kts; mismatches can leave store metadata disconnected from the APK version being released.
Risks
- app/build.gradle.kts computes
baseVersionNamefromcurrentVersion.namebut names output APKs withdefaultConfig.versionName; thefdroidflavor overridesversionName, yet output naming may still use the default version string. If release scripts or consumers assume flavor-specific names, F-Droid builds can be mislabeled. - .github/…/android.yml runs
gradle assembleReleaseinstead of./gradlew assembleRelease, while .github/…/android_ci.yml uses./gradlew. If the runner Gradle version diverges fromgradle/wrapper/gradle-wrapper.properties, manual releases can behave differently from CI. - color/build.gradle.kts sets
compileOptions.sourceCompatibilitytwice and never assignstargetCompatibilityinsidecompileOptions. If Java bytecode compatibility for the library is tightened, this typo can leave the target level different from what reviewers expect.