Build Configuration
Build Configuration
This section outlines the necessary Gradle configurations, dependencies, and Proguard settings required to build and deploy the RideEase application. The project uses the Gradle build system to manage dependencies and build variants.
Gradle Dependencies
The RideEase application relies on several core libraries for Firebase integration, UI components, and the MVVM architecture. Ensure the following dependencies are present in your app/build.gradle or app/build.gradle.kts file:
dependencies {
// Core AndroidX libraries
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
// Splash Screen API (Android 12+)
implementation("androidx.core:core-splashscreen:1.0.1")
// Lifecycle and ViewModel
implementation("androidx.lifecycle:lifecycle-viewmodel:2.6.1")
implementation("androidx.lifecycle:lifecycle-livedata:2.6.1")
// Firebase Suite
implementation(platform("com.google.firebase:firebase-bom:32.2.0"))
implementation("com.google.firebase:firebase-auth")
implementation("com.google.firebase:firebase-firestore")
// Animations
implementation("com.airbnb.android:lottie:6.0.0")
// Unit and Instrumented Testing
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
Build Features
The project heavily utilizes View Binding to interact with UI components securely and efficiently. This must be enabled in the android block of your module-level build file:
android {
...
buildFeatures {
viewBinding = true
}
}
Gradle Wrapper Settings
To ensure build consistency across different development environments, the project uses the Gradle Wrapper. The recommended settings in gradle-wrapper.properties are:
| Property | Value |
| :--- | :--- |
| Distribution URL | https://services.gradle.org/distributions/gradle-8.0-bin.zip |
| Android Gradle Plugin (AGP) | 8.x.x |
Firebase Configuration
To successfully build the app with Firebase Auth and Firestore features:
- Place the
google-services.jsonfile in theapp/directory. - Ensure the Google Services plugin is applied at the bottom of the
app/build.gradlefile:plugins { id("com.android.application") id("com.google.gms.google-services") }
Proguard and R8 Rules
For release builds, Proguard/R8 is used to minify and obfuscate the code. Since RideEase uses Firebase and various AndroidX libraries, specific rules are required to prevent the stripping of necessary classes.
In your proguard-rules.pro file, ensure the following are configured:
# Preserve Firebase and Google Play Services
-keep class com.google.firebase.** { *; }
-keep class com.google.android.gms.** { *; }
# Preserve Model classes (to prevent issues with Firestore serialization)
-keep class com.rideease.app.models.** { *; }
# Lottie Animation rules
-keep class com.airbnb.lottie.** { *; }
# Prevent obfuscation of ViewModel classes
-keepclassmembers class * extends androidx.lifecycle.ViewModel {
public <init>();
}
Build Variants
The application currently supports the standard debug and release build types.
- Debug: Enables logging for Firebase Auth results and Firestore queries.
- Release: Minification enabled; requires a valid signing configuration to interact with Firebase Phone Authentication (SHA-1/SHA-256 fingerprints must be registered in the Firebase Console).