A sample Uber-like ride-hailing Android application built exclusively with the Bazel build system. Features Google Maps integration, ride type selection, and mock data for demonstration purposes.
- 🗺️ Google Maps integration with pickup/dropoff markers
- 🚗 Multiple ride types (UberX, UberXL, Uber Black)
- 💰 Real-time fare estimation
- 📍 Location-based services
- 🎨 Material Design UI with bottom sheet
- 🔧 Built with Bazel build system (no Gradle!)
Before building this project, ensure you have the following installed:
Install Bazel (version 7.0 or higher):
# macOS
brew install bazel
# Or download from https://bazel.build/installVerify installation:
bazel versionInstall Android SDK (API level 34 required):
Option A: Using Android Studio (Recommended)
- Download and install Android Studio
- Open Android Studio and go to Tools → SDK Manager
- Install "Android SDK Platform 34" and "Android SDK Build-Tools 34"
- SDK will be at:
~/Library/Android/sdk(macOS) or~/Android/Sdk(Linux)
Option B: Using sdkmanager
sdkmanager "platforms;android-34"
sdkmanager "build-tools;34.0.0"Add to your ~/.zshrc or ~/.bash_profile:
export ANDROID_HOME=$HOME/Library/Android/sdk # macOS
# or
export ANDROID_HOME=$HOME/Android/Sdk # Linux
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-toolsThen reload your shell:
source ~/.zshrc # or ~/.bash_profileTo enable Google Maps functionality:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable "Maps SDK for Android"
- Create credentials (API Key)
- Restrict the key to Android apps
- Add your app's package name:
com.uber.sample - Get your debug keystore SHA-1:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android - Add the SHA-1 to your API key restrictions
- Update the API key in
app/src/main/res/values/strings.xml:<string name="google_maps_key">YOUR_API_KEY_HERE</string>
Note: The app will run without a valid API key, but the map will show a "For development purposes only" watermark.
cd uber-android
bazel build //app:uber_appThe APK will be generated at: bazel-bin/app/uber_app.apk
Using ADB:
# Connect your Android device or start an emulator
adb devices
# Install the APK
adb install -r bazel-bin/app/uber_app.apkUsing Bazel mobile-install (faster for development):
bazel mobile-install //app:uber_app# Clean build artifacts
bazel clean
# Deep clean (removes all cached data)
bazel clean --expunge# Build just the library
bazel build //app:uber_lib
# Run queries
bazel query //app/...
# Show dependency tree
bazel query --output=graph //app:uber_app > graph.dotuber-android/
├── WORKSPACE # Bazel workspace configuration
├── MODULE.bazel # Bazel module definition
├── BUILD.bazel # Root build file
├── .bazelrc # Bazel configuration
├── app/
│ ├── BUILD.bazel # App build configuration
│ ├── AndroidManifest.xml # Android manifest
│ └── src/main/
│ ├── java/com/uber/sample/
│ │ ├── MainActivity.kt # Main activity
│ │ ├── models/
│ │ │ ├── RideType.kt # Ride type enum
│ │ │ └── Location.kt # Location data class
│ │ ├── ui/
│ │ │ ├── MapFragment.kt # Google Maps fragment
│ │ │ └── RideBookingBottomSheet.kt # Bottom sheet UI
│ │ └── data/
│ │ └── MockDataProvider.kt # Sample data
│ └── res/
│ ├── layout/ # XML layouts (5 files)
│ ├── values/ # Strings, colors, themes
│ └── drawable/ # Vector drawables
└── third_party/
└── BUILD.bazel # Third-party dependencies marker
The WORKSPACE file defines:
- Android Rules:
rules_androidv0.5.1 for Android build support - Kotlin Rules:
rules_kotlinv1.9.6 for Kotlin compilation - Maven Dependencies:
rules_jvm_externalfor managing Maven artifacts
Defines two main targets:
android_binary(uber_app): The final APKkt_android_library(uber_lib): Kotlin library with all source code
All dependencies are managed through Maven and defined in WORKSPACE:
- AndroidX libraries (AppCompat, ConstraintLayout, Fragment, etc.)
- Material Design Components
- Google Play Services (Maps, Location)
- Kotlin standard library
The app includes mock data for demonstration:
- Pickup: Market Street, San Francisco, CA (37.7749°N, 122.4194°W)
- Dropoff: Broadway, Oakland, CA (37.8044°N, 122.2712°W)
| Ride Type | Price/Mile | Capacity | ETA |
|---|---|---|---|
| UberX | $1.50 | 4 | 5min |
| UberXL | $2.25 | 6 | 7min |
| Uber Black | $3.50 | 4 | 8min |
- Launch the app on your Android device or emulator
- Grant location permissions when prompted
- The map will load with default pickup and dropoff locations
- Swipe up on the bottom sheet to see ride options
- Tap on a ride type to select it
- Tap "Request Ride" to simulate booking
- Language: Kotlin
- Build System: Bazel (v9.0)
- Maps: Google Maps Android API
- UI Framework: Material Design Components
- Architecture: Single Activity with Fragments
MainActivity.kt (app/src/main/java/com/uber/sample/MainActivity.kt:19)
- Handles location permissions
- Coordinates map and bottom sheet
MapFragment.kt (app/src/main/java/com/uber/sample/ui/MapFragment.kt:21)
- Displays Google Maps
- Shows pickup/dropoff markers
- Draws route line
RideBookingBottomSheet.kt (app/src/main/java/com/uber/sample/ui/RideBookingBottomSheet.kt:17)
- Lists available ride types
- Handles ride selection
- Displays fare estimates
MockDataProvider.kt (app/src/main/java/com/uber/sample/data/MockDataProvider.kt:11)
- Provides sample locations
- Calculates trip estimates
- Supplies ride type data
Error: Android SDK not found
# Verify ANDROID_HOME is set
echo $ANDROID_HOME
# Should output something like: /Users/your-username/Library/Android/sdkError: Could not find SDK version
# List installed SDK versions
ls $ANDROID_HOME/platforms/
# Install required SDK
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platforms;android-34"Error: rules_android not found
# Clean and retry
bazel clean --expunge
bazel build //app:uber_appMap not loading
- Verify you have a valid Google Maps API key
- Check that "Maps SDK for Android" is enabled in Google Cloud Console
- Ensure your package name (
com.uber.sample) and SHA-1 are in API key restrictions
Location permission denied
- Go to device Settings → Apps → Uber Sample → Permissions
- Enable Location permission
App crashes on startup
- Check logs:
adb logcat | grep AndroidRuntime - Ensure you built with:
bazel build //app:uber_app
Bazel version issues
# Check version
bazel version
# Update Bazel
brew upgrade bazelDependency resolution fails
# Clean Maven cache
rm -rf ~/.cache/bazel
# Retry build
bazel build //app:uber_appBuild is slow
# Use disk cache (already configured in .bazelrc)
# Verify it's enabled
bazel info | grep disk_cache- Add new Kotlin files to
app/src/main/java/com/uber/sample/ - Add new resources to
app/src/main/res/ - Files will be automatically included via
glob()inBUILD.bazel - Build and test:
bazel build //app:uber_app adb install -r bazel-bin/app/uber_app.apk
-
Edit
WORKSPACEfile and add tomaven_install:maven_install( artifacts = [ # ... existing dependencies "com.example:new-library:1.0.0", ], # ... )
-
Add to
app/BUILD.bazelin thedepslist:deps = [ # ... existing deps "@maven//:com_example_new_library", ]
-
Clean and rebuild:
bazel sync --configure bazel build //app:uber_app
# Generate build dependency graph
bazel query --output=graph //app:uber_app > graph.in
# Convert to PNG (requires Graphviz)
dot -Tpng < graph.in > graph.png- Fast Incremental Builds: Only rebuilds what changed
- Reproducible Builds: Same source → same output, always
- Scalable: Handles monorepos with thousands of targets
- Multi-language: Build Java, Kotlin, C++, and more in one system
- Remote Caching: Share build artifacts across teams
- Hermetic: Doesn't depend on system-installed tools
On a typical development machine:
- Full build: ~45-60 seconds (first time)
- Incremental build: ~5-10 seconds (after code changes)
- No-op build: <2 seconds
This is a sample application for demonstration purposes.