Prerequisites
Before building, ensure you have:- Android SDK installed
- Java Development Kit (JDK) 11 or higher
- Environment variables set (ANDROID_HOME)
Building with Gradle
Basic Build Command
To build the app from the command line:Build Specific Variants
Debug Build
Build the debug variant (includes debugging symbols, not optimized):Output location:
app/build/outputs/apk/debug/app-debug.apkClean Build
To remove all build artifacts and start fresh:Build Configuration
The build configuration is defined inapp/build.gradle.kts:
Key Configuration Values
- Application ID:
com.teamtech.techsales - Namespace:
com.teamtech.techsales - Compile SDK: 36 (Android API level 36)
- Min SDK: 29 (Android 10)
- Target SDK: 36
- Version Code: 1
- Version Name: 1.0
- Java Version: 11
Build Variants
TechSales has two build types configured:Debug Variant
- Purpose: Development and testing
- Minification: Disabled
- Debugging: Enabled
- Signing: Uses debug keystore automatically
- Output:
app-debug.apk
Release Variant
- Purpose: Production distribution
- Minification: Currently disabled (
isMinifyEnabled = false) - ProGuard: Configured but not enabled
- Signing: Requires release keystore configuration
- Output:
app-release-unsigned.apk
Minification is currently disabled for release builds. To enable code shrinking and obfuscation, set
isMinifyEnabled = true in the release build type.ProGuard Configuration
ProGuard rules are defined inapp/proguard-rules.pro. While minification is currently disabled, the configuration file is ready for use:
proguard-android-optimize.txt(from Android SDK)proguard-rules.pro(project-specific rules)
Enabling ProGuard
To enable code shrinking and obfuscation:- Edit
app/build.gradle.kts - Change
isMinifyEnabled = falsetoisMinifyEnabled = true - Add any necessary keep rules to
proguard-rules.pro - Rebuild the release variant
Build Output Locations
After building, artifacts are generated in the following locations:APK Files
Build Intermediates
Build Logs
Gradle Tasks
Useful Gradle tasks for building:Build Performance
Gradle Daemon
The Gradle daemon improves build performance by keeping build components in memory. It’s enabled by default.Parallel Builds
Gradle can build independent modules in parallel. Checkgradle.properties for parallel execution settings.
Build Cache
Gradle’s build cache reuses outputs from previous builds:Troubleshooting
Clean Build
If you encounter build issues, try cleaning:Gradle Wrapper Update
Ensure you’re using the correct Gradle version:Dependency Issues
Refresh dependencies:Next Steps
Running
Learn how to run the built APK
Testing
Run tests before building release