Dependency Management
RideEase uses Gradle Version Catalogs to centralize and manage dependencies. This approach provides a single source of truth for library versions and plugin configurations, ensuring consistency across all modules in the project.
All dependency definitions are located in the gradle/libs.versions.toml file.
Usage Overview
To manage or add a dependency in the RideEase project, you interact with the Version Catalog instead of hardcoding version strings in individual build.gradle files.
1. Catalog Structure
The libs.versions.toml file is divided into three primary sections:
- [versions]: Defines the version numbers for libraries and plugins.
- [libraries]: Defines the alias and the specific library coordinates (group:name).
- [plugins]: Defines the Gradle plugins used in the build process.
2. Implementation in Build Scripts
To use a dependency defined in the catalog within your module's build.gradle file, use the generated libs accessors:
dependencies {
// Standard AndroidX & UI
implementation libs.androidx.appcompat
implementation libs.androidx.lifecycle.viewmodel
implementation libs.androidx.lifecycle.livedata
implementation libs.material
// Firebase Services
implementation libs.firebase.auth
implementation libs.firebase.firestore
// UI/Animations
implementation libs.lottie
}
Core Dependencies
The following table summarizes the primary libraries currently utilized by RideEase as seen in the codebase:
| Category | Library Alias (Reference) | Description |
| :--- | :--- | :--- |
| Authentication | libs.firebase.auth | Manages user login, signup, and phone verification. |
| Database | libs.firebase.firestore | Cloud NoSQL database for storing user profiles and ride data. |
| Lifecycle | libs.androidx.lifecycle.* | Implements the ViewModel and LiveData patterns for reactive UI. |
| UI Components | libs.androidx.appcompat | Provides backward-compatible versions of Android UI components. |
| Animations | libs.lottie | Handles loading and success animations via Lottie JSON files. |
| Splash Screen | libs.androidx.core.splashscreen | Manages the brand splash screen experience (Android 12+ compatibility). |
Adding or Updating Dependencies
To Update a Version
Modify the version value in the [versions] block. This change will automatically propagate to all libraries referencing that version alias.
[versions]
firebaseAuth = "22.3.0" # Update this value to upgrade
To Add a New Library
- Add the version to
[versions]. - Define the library mapping in
[libraries]. - Sync the project with Gradle files.
- Reference it in the relevant
build.gradlefile usingimplementation libs.your.alias.
View Binding
While not a standalone library dependency in the catalog, View Binding is enabled project-wide to facilitate safe interactions with UI elements (e.g., ActivityLoginBinding). It is configured in the android block of the module's build.gradle:
android {
buildFeatures {
viewBinding true
}
}
Testing Dependencies
RideEase includes standard Android testing libraries for instrumented and unit tests:
- JUnit:
libs.junit - AndroidX Test:
libs.androidx.test.ext.junitandlibs.androidx.test.espresso.core
These are referenced using testImplementation and androidTestImplementation respectively.