A modern Android running & fitness tracker built with Kotlin, Jetpack Compose, and Clean Multi-Module Architecture.
Lerun is an Android running tracker application that records your outdoor runs in real time, visualizes routes on Google Maps, calculates key workout metrics (distance, pace, duration, calories burned), and stores your activity history locally on your device.
- Real-Time GPS Run Tracking: Tracks your running route, live duration, distance, average speed, and calories burned using a
StateFlow-backed foreground location service (TrackingService) isolated in:feature:tracking. - Interactive Route Visualization: Smoothly loads Google Maps (
MapsInitializer.Renderer.LATEST), centers the camera on the user's live location pin within a bounded viewport, provides a My Location re-center button and a location-loading indicator, draws smoothed live polylines, and captures route snapshots upon completing a run. - Run Dashboard & History: View greeting, promo banner, summary stats, interactive speed line chart, and recent activities on the home screen, or browse all runs sorted by Date, Duration, Distance, Average Speed, or Calories Burned (
:feature:home). - Detailed Run Breakdown: Inspect individual run metrics and route snapshots with dedicated screen state (
DetailRunViewModel). - Workout Statistics: Visualize your cumulative progress (total distance, total time, total calories, average speed) alongside interactive bar charts (
:feature:statistics). - Personalized Onboarding & Settings: Set up your profile (name, weight, profile picture with a native Jetpack Compose pinch-to-zoom image cropper), inspect open-source licenses in a Compose dialog, and toggle between Dark and Light themes with edge-to-edge system bar support.
Lerun originally started as a single-module Android app built with legacy XML Views, Fragments, and Navigation Component, and has been migrated to 100% Jetpack Compose alongside a multi-module Clean Architecture and build-logic Gradle Convention Plugins:
| Area | Legacy (XML) | Modernized (Jetpack Compose) |
|---|---|---|
| UI Layer | XML Layouts (ConstraintLayout, RecyclerView, CardView) |
Declarative Jetpack Compose & Material 3 |
| App Structure | Multiple Fragment classes hosted in an XML NavHostFragment |
Single-Activity (MainActivity) with Compose screens & routes |
| Navigation | Fragment XML Navigation Graph | Modularized, type-safe Jetpack Navigation 3 (NavDisplay, NavBackStack, feature EntryProviderScope<NavKey> builders, kotlinx.serialization) |
| Design System | XML styles & attributes | Centralized Compose theme (LerunTheme, Color, Type, Icons) in :core:ui |
| Visual Effects | BlurView (View hierarchy blur) |
Compose-native glassmorphism with Haze 2.1 (dev.chrisbanes.haze.blur) |
| Image Cropping & OSS Licenses | Legacy AppCompat Activities (Android-Image-Cropper, OssLicensesMenuActivity) |
100% Compose ImageCropperDialog (pinch-to-zoom, pan & EXIF handling) & OssLicensesDialog |
| View Interop | Native XML widgets | Seamless Compose AndroidView interoperability for Google Maps MapView & MPAndroidChart |
Current Migration Status: All user flows (Onboarding, Home Dashboard, All Runs, Run Detail, Live Tracking, Statistics, and Settings) and app navigation are implemented in Jetpack Compose with Jetpack Navigation 3. Each
:feature:*module defines its own serializableNavKeyroutes andEntryProviderScope<NavKey>entry builders, assembled in:app(AppNavigation.kt) with onboarding hosted directly insideNavDisplay.
The project follows Clean Architecture principles combined with MVI (Model-View-Intent) / Unidirectional Data Flow (UDF) and 100% Kotlin Flow across all layers (no LiveData), organized into feature, core, and build-logic modules for strict dependency encapsulation and build performance:
- Consistent MVI Pattern: Every screen exposes an
@ImmutableState, a sealedActioninterface for user/system intents, and aChannel-backedEventFlowfor one-off side effects (AppUiViewModel,OnboardingViewModel,HomeViewModel,AllRunsViewModel,DetailRunViewModel,TrackingViewModel,SettingViewModel,StatisticViewModel). - Compose Stability & State-Holder Split: Route composables resolve their
@HiltViewModelviahiltViewModel()and pass immutable state plusonActioncallbacks into stateless UI composables—avoidingViewModelparameters in UI composables for clean previews, testing, and recomposition skipping. - Strict Clean Architecture Boundaries:
:feature:*modules depend only on:core:domain,:core:ui, and:core:common(never:core:data), while:appassembles the Hilt dependency graph with:core:data.
Lerun/
├── build-logic/
│ └── convention/ # Gradle Convention Plugins (lerun.android.application, library, compose, hilt, feature)
├── app/ # Application entry point (MainActivity), AppUiViewModel, Navigation 3 NavDisplay host & DI wiring
├── core/
│ ├── common/ # Lightweight shared utilities, constants, bitmap converters, and formatting helpers
│ ├── domain/ # Pure business logic: Domain models, Flow-based Repository interfaces, and UseCases
│ ├── data/ # Data layer: Room database (Flow queries), DAOs, SharedPreferences storage, mappers & Repository impls
│ └── ui/ # Shared Compose Design System (LerunTheme, typography, colors, icons) & reusable UI components
├── feature/
│ ├── onboarding/ # First-time user setup screen, OnboardingViewModel (MVI) & OnboardingNavigation
│ ├── home/ # Home dashboard (HomeViewModel), All Runs history (AllRunsViewModel), Run Detail (DetailRunViewModel) & HomeNavigation
│ ├── tracking/ # Live GPS workout recording (TrackingScreen, TrackingViewModel, TrackingService) & TrackingNavigation
│ ├── statistics/ # Running analytics, chart visualization screen, StatisticViewModel (MVI) & StatisticsNavigation
│ └── settings/ # User profile settings, Compose ImageCropperDialog & OssLicensesDialog, SettingViewModel & SettingsNavigation
└── baselineprofile/ # Macrobenchmark & Baseline Profile generator for startup & runtime optimization
- Kotlin: 100% Kotlin codebase with Kotlinx Serialization.
- Coroutines & Flow: Structured concurrency and reactive state streams (
Flow,StateFlow,Channelevents) end-to-end from Room DAOs to UI, with zeroLiveDatausage. - Gradle Convention Plugins (
build-logic): Centralized build configuration for AGP 9, Compose Compiler, Hilt, KSP, and feature dependencies. - Java & Android SDK: Java 11 bytecode compatibility target (
minSdk = 24,targetSdk = 37,compileSdk = 37), built with JDK 17+.
- Jetpack Compose: Modern declarative UI toolkit with Material 3.
- Jetpack Navigation 3: Modularized type-safe Compose navigation (
androidx.navigation3:navigation3-runtime,navigation3-ui, andlifecycle-viewmodel-navigation3) with per-tab back stacks, onboarding insideNavDisplay, and custom hierarchical/top-level transitions. - Haze 2.1: Modular background blur and material presets (
haze,haze-blur,haze-blur-materials) for Jetpack Compose. - MPAndroidChart: Interactive line and bar charts rendered via Compose
AndroidView.
- Hilt (Dagger): Compile-time dependency injection with KSP and
hiltViewModel()Compose integration. - Jetpack Lifecycle & ViewModel: Lifecycle-aware state holders (
collectAsStateWithLifecycle,LifecycleService). - Room Persistence: Local SQLite database abstraction for storing runs, route bitmaps, and user images.
- Baseline Profiles: Ahead-of-time (AOT) compilation profiles for faster app startup and smoother Compose scrolling.
- Google Maps SDK for Android: Displays live running routes, custom markers, and snapshots.
- Google Play Services Location:
FusedLocationProviderClientfor high-accuracy location tracking. - Activity Result APIs: Compose
rememberLauncherForActivityResultfor runtime location, notification, and photo picker permissions.
- Firebase Suite: Analytics, Crashlytics, Performance Monitoring, Remote Config, Cloud Messaging, and App Distribution.
- Timber: Extensible logging utility.
- Spotless + ktlint (
1.8.0): Automated code formatting for Kotlin (ktlintwith Compose-aware rules in.editorconfig) and Java (googleJavaFormat) configured inspotless.gradle.
- Android Studio: Latest stable version (supporting AGP
9.xand Compile SDK37). - JDK: Java 17 or higher (required by Gradle 9 and AGP 9; project compiles with Java 11 target compatibility, and
gradlew/gradle.propertiesinclude--enable-native-access=ALL-UNNAMEDfor clean execution on JDK 24+). - Android Device or Emulator: Running Android 7.0 (API 24) or higher with Google Play Services installed.
git clone https://github.com/arrazyfathan/Lerun.git
cd LerunLerun uses the Google Maps SDK to render live tracking maps and route snapshots. The API key is loaded from local.properties (which is ignored by Git) or the MAPS_API_KEY environment variable and injected into AndroidManifest.xml via manifestPlaceholders.
- Obtain a Maps SDK for Android API key from the Google Cloud Console.
- Add
MAPS_API_KEYto your rootlocal.propertiesfile:MAPS_API_KEY=YOUR_GOOGLE_MAPS_API_KEY
The repository includes a sample app/google-services.json for development builds. If you want to connect your own Firebase project (for Crashlytics, Analytics, Remote Config, and FCM):
- Create a project in the Firebase Console.
- Register an Android app with package name
com.arrazyfathan.lerun. - Download your
google-services.jsonand place it in theapp/directory.
You can open the project directly in Android Studio and click Run, or build it from the command line:
# Assemble the debug APK
./gradlew assembleDebug
# Install on a connected device/emulator
./gradlew installDebug# Run unit tests (including NavigationStateTest)
./gradlew testDebugUnitTest
# Run Compose UI & Navigation 3 instrumentation tests on a connected device/emulator
./gradlew :app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.arrazyfathan.lerun.ComposeScreensTest
# Check code formatting with Spotless (ktlint + googleJavaFormat)
./gradlew spotlessCheck
# Automatically format code with Spotless
./gradlew spotlessApplyGo to the Releases page to download the latest APK.
MIT License
Copyright (c) [2021] [Ar Razy Fathan Rabbani]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.




