buildSrc for consistency across all modules.
Project structure
The project is organized as a multi-module Gradle project with the following structure:Build configuration
Centralized configuration
Build settings are defined inAppConfig.kt located in buildSrc/src/main/java/es/mobiledev/buildsrc/AppConfig.kt:1:
Version catalog
The project uses Gradle version catalogs (gradle/libs.versions.toml:1) for dependency management:Key dependencies
Key dependencies
- Android Gradle Plugin: 8.13.0
- Kotlin: 2.2.20
- Compose BOM: 2025.10.00
- Hilt: 2.56.2
- Room: 2.8.4
- Retrofit: 3.0.0
- KtLint: 13.1.0
Build types
The app module defines two build types in app/build.gradle.kts:26:ProGuard is currently disabled in release builds. Enable
isMinifyEnabled = true for production to reduce APK size and obfuscate code.Building the project
Prerequisites
Before building, ensure you have:Build commands
Clean builds
When experiencing build issues, perform a clean build:Gradle tasks
The project includes several custom Gradle tasks:Pre-build tasks
The app module automatically runs code quality checks before building (app/build.gradle.kts:48):Common tasks
Build tasks
Build tasks
./gradlew assemble- Build all variants./gradlew assembleDebug- Build debug APK./gradlew assembleRelease- Build release APK./gradlew bundle- Build Android App Bundle (AAB)./gradlew bundleRelease- Build release AAB
Verification tasks
Verification tasks
./gradlew check- Run all checks and tests./gradlew lint- Run Android Lint checks./gradlew test- Run unit tests./gradlew connectedAndroidTest- Run instrumented tests
Code quality tasks
Code quality tasks
./gradlew ktlintCheck- Check code style./gradlew ktlintFormat- Auto-format code- See Code style for more details
Parallel builds
Enable parallel builds for faster compilation by adding to gradle.properties:13:The project is configured with decoupled modules, making it suitable for parallel execution.
Compilation settings
Java compatibility
All modules target Java 11 (app/build.gradle.kts:32):Kotlin compiler options
The project uses the official Kotlin code style (gradle.properties:19):Compose compiler
Jetpack Compose is enabled through the Kotlin Compose plugin:Build optimization
JVM arguments
The project allocates 2GB of heap memory for Gradle (gradle.properties:9):Non-transitive R classes
The project enables non-transitive R classes (gradle.properties:23) to reduce R class size:Build cache
Enable Gradle build cache for faster builds:Module configuration
Application module
The main app module (app/build.gradle.kts:1) uses:- Android Application plugin
- Kotlin Android plugin
- Kotlin Compose plugin
- KSP for annotation processing
- Hilt for dependency injection
Feature modules
Feature modules (feature/home/build.gradle.kts:1) use:- Android Library plugin
- Same Kotlin and Compose plugins as app
- Share the centralized
AppConfigfor SDK versions
Type-safe project accessors
The project uses type-safe project accessors (settings.gradle.kts:18) for cleaner dependency declarations:Troubleshooting
Build fails after pulling changes
Gradle daemon issues
KSP compilation errors
Clean the KSP generated sources:Out of memory errors
Increase heap size in gradle.properties:Next steps
Testing
Learn how to run unit and instrumented tests
Code style
Configure KtLint and code formatting