Overview
This guide walks you through setting up a complete development environment for Divvy, including building from the command line, configuring Supabase authentication, and understanding the project structure.Prerequisites
Ensure you have the following installed:- Android Studio: Latest stable version (Jellyfish or newer recommended)
- Java Development Kit (JDK): Version 8 or higher
- Gradle: Included with Android Studio (no separate installation needed)
- Git: For cloning the repository
- Supabase account: For backend and authentication
Divvy targets Android API level 26 (Android 8.0) and above, with a compile SDK of 36.
Installation steps
Configure local.properties
Create a Add your Supabase credentials to this file:The Supabase client is initialized using these values in the
local.properties file in the project root directory:local.properties
How credentials are used
The build system reads these properties and injects them as BuildConfig fields that are accessible at runtime:app/build.gradle.kts
SupabaseClientProvider:app/src/main/java/com/example/divvy/backend/SupabaseClientProvider.kt
Set up Supabase Authentication
Configure Google authentication in your Supabase dashboard:After successful authentication, the user is redirected to
- Go to your Supabase Dashboard
- Select your project
- Navigate to Authentication > Providers
- Enable the Google provider
- Add
com.example.divvy://authto the Redirect URLs list
How authentication works
Divvy uses Supabase GoTrue for authentication. The auth flow is handled byAuthActivity:app/src/main/java/com/example/divvy/AuthActivity.kt
MainActivity.Sync Gradle
Open the project in Android Studio:
- Launch Android Studio
- Click File > Open
- Select the
divvydirectory - Click OK
- Wait for Gradle to sync automatically
The first sync may take several minutes as Gradle downloads dependencies including Jetpack Compose, Supabase SDK, CameraX, and Hilt.
Build from the command line
You can build the app without Android Studio using Gradle:This creates a debug APK at:
Other useful Gradle commands
Project structure
Understanding the codebase organization:Key files
app/build.gradle.kts: Defines dependencies, build types, and BuildConfig fieldsbackend/SupabaseClientProvider.kt: Singleton that provides the configured Supabase clientui/MainScreen.kt: Root composable that sets up navigation and bottom barui/navigation/AppNavHost.kt: Navigation graph for the appmodels/: Data classes for Group, Expense, Split, and other domain objects
Development workflow
Once you have the app running, you can:- Make code changes: Edit Kotlin files in Android Studio
- Hot reload: Press
Ctrl + Shift + F9to apply changes without restarting - Debug: Set breakpoints and use Android Studio’s debugger
- View logs: Use Logcat to see runtime logs from the app
Dependencies
Divvy uses the following key dependencies:- Jetpack Compose: Modern declarative UI framework
- Supabase Kotlin SDK: Backend and authentication (
postgrest-kt,gotrue-kt) - Hilt: Dependency injection
- CameraX: Camera functionality for receipt scanning
- Coil: Image loading for user avatars
- Navigation Compose: Type-safe navigation
- Material 3: Material Design components
app/build.gradle.kts.
Optional configuration
Auth bypass (for testing)
You can bypass authentication during development by adding this tolocal.properties:
app/src/main/java/com/example/divvy/AuthActivity.kt
Troubleshooting
Gradle sync fails
If Gradle sync fails:- Ensure
local.propertiesexists and contains valid Supabase credentials - Check that you’re using JDK 8 or higher
- Try File > Invalidate Caches > Invalidate and Restart
- Run
./gradlew cleanand sync again
App crashes on launch
If the app crashes immediately:- Check Logcat for error messages
- Verify your Supabase URL and anon key are correct
- Ensure you’ve enabled Google auth in Supabase dashboard
- Check that the redirect URL
com.example.divvy://authis configured
Camera not working
If receipt scanning doesn’t work:- Grant camera permissions when prompted
- Test on a physical device (emulator cameras have limitations)
- Check that CameraX dependencies are properly installed
Next steps
Now that you have a complete development environment:- Review the contributing guidelines for contribution workflow
- Explore the API reference to understand the data models
- Check out feature guides for implementation details