Development Guide

Setting Up Development Environment

Requirements

  • Java Development Kit: JDK 11 or higher

  • Android Studio: Latest stable version (Hedgehog or newer recommended)

  • Android SDK: API levels 24-36

  • Git: For version control

Steps

  1. Install Android Studio

    • Download from developer.android.com

    • Install with default settings

    • Open SDK Manager

    • Install Android SDK Platform 36

    • Install Android SDK Build-Tools 34.0.0+

  2. Clone Repository

    git clone https://github.com/yourusername/Pebbl.git
    cd Pebbl
  3. Configure local.properties

    sdk.dir=C\:\\Users\\YourUsername\\AppData\\Local\\Android\\Sdk
    OPENROUTER_API_KEY=your_api_key_here
  4. Sync Gradle

    • Open project in Android Studio

    • Wait for Gradle sync to complete

    • Resolve any dependency issues

  5. Run on Emulator/Device

    • Create AVD (Android Virtual Device) with API 24+

    • Or connect physical device with USB debugging

    • Click Run (Shift+F10)

Building the App

Debug Build

Output: app/build/outputs/apk/debug/app-debug.apk

Release Build

For signed release:

  1. Create keystore:

  2. Add to local.properties:

  3. Update build.gradle.kts:

  4. Build signed release:

Output: app/build/outputs/apk/release/app-release.apk

Running Tests

Unit Tests

Located in app/src/test/

Run all tests:

Run specific test:

Instrumented Tests

Located in app/src/androidTest/

Run on connected device:

Example Unit Test

Code Style

Kotlin Style Guide

Follow Kotlin Coding Conventions

Key points:

  • Naming: camelCase for functions/variables, PascalCase for classes

  • Indentation: 4 spaces (no tabs)

  • Line length: Max 120 characters

  • Imports: No wildcard imports, organize alphabetically

  • Trailing commas: Use in multi-line parameter lists

Compose Best Practices

  • State Hoisting: Lift state to composable callers

  • Reusability: Create small, focused composables

  • remember: Use for expensive computations

  • LaunchedEffect: For side effects tied to lifecycle

  • derivedStateOf: For derived state calculations

Example Well-Formatted Code

Last updated