Skip to content

Android Development Guide

Garot Conklin edited this page Dec 15, 2024 · 1 revision

Android Development Guide

Development Environment Setup

Required Tools

  1. JDK: OpenJDK 17 or later
  2. Android Studio: Latest stable version (Hedgehog | 2023.1.1)
  3. Git: Latest version
  4. GitHub CLI: For repository management

Initial Setup

# Clone the repository
git clone https://github.com/fleXRPL/RunOn.git
cd RunOn

# Create and switch to development branch
git checkout -b development

Project Configuration

Android Studio Settings

  1. Code Style:

    • Enable ktlint formatting
    • Use project-specific settings
    // .editorconfig
    root = true
    [*.{kt,kts}]
    ktlint_code_style = official
    max_line_length = 120
  2. Gradle Settings:

    • Gradle JDK: JDK 17
    • Enable configuration cache
    • Enable build cache

Build Configuration

// app/build.gradle.kts
plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("com.google.dagger.hilt.android")
    id("com.google.devtools.ksp")
}

android {
    namespace = "com.flexrpl.runon"
    compileSdk = 34
    
    defaultConfig {
        minSdk = 26
        targetSdk = 34
        versionCode = 1
        versionName = "1.0.0"
    }
    
    buildFeatures {
        compose = true
    }
    
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.3"
    }
}

Development Workflow

Git Workflow

  1. Branch Naming:

    feature/[feature-name]
    bugfix/[bug-description]
    enhancement/[enhancement-description]
    
  2. Commit Messages:

    feat: Add event discovery screen
    fix: Resolve calendar sync issue
    docs: Update API documentation
    refactor: Improve event filtering logic
    
  3. Pull Request Process:

    • Create feature branch
    • Implement changes
    • Run tests and checks
    • Create PR with description
    • Request review
    • Address feedback
    • Merge after approval

Code Quality Checks

  1. Pre-commit Checks:

    ./gradlew ktlintCheck
    ./gradlew detekt
    ./gradlew test
  2. CI/CD Pipeline:

    • Automated tests
    • Code quality checks
    • Build verification
    • Release management

Testing Guidelines

Unit Testing

@Test
fun `event filtering should return matching events`() {
    // Given
    val events = listOf(/* test data */)
    
    // When
    val filtered = useCase.filterEvents(events, criteria)
    
    // Then
    assertThat(filtered).hasSize(expectedSize)
}

UI Testing

@Test
fun eventListDisplaysCorrectly() {
    composeTestRule.setContent {
        EventList(events = testEvents)
    }
    
    composeTestRule
        .onNodeWithText("Event Title")
        .assertIsDisplayed()
}

Debugging

Tools and Techniques

  1. Layout Inspector:

    • Analyze UI hierarchy
    • Debug Compose issues
  2. Network Profiler:

    • Monitor API calls
    • Analyze response times
  3. Memory Profiler:

    • Track memory usage
    • Identify leaks

Logging

object Logger {
    fun d(tag: String, message: String) {
        if (BuildConfig.DEBUG) {
            Log.d(tag, message)
        }
    }
    
    // Additional log levels...
}

Release Process

Build Types

  1. Debug:

    • Development features enabled
    • Logging enabled
    • Test endpoints
  2. Release:

    • Optimized build
    • ProGuard enabled
    • Production endpoints

Version Management

// Version.kt
object Version {
    const val MAJOR = 1
    const val MINOR = 0
    const val PATCH = 0
    const val BUILD = 1
    
    fun versionName() = "$MAJOR.$MINOR.$PATCH"
    fun versionCode() = MAJOR * 10000 + MINOR * 1000 + PATCH * 100 + BUILD
}

Release Checklist

  1. Update version numbers
  2. Run full test suite
  3. Generate release notes
  4. Create signed bundle
  5. Submit to Play Store
  6. Tag release in Git

Documentation

Code Documentation

/**
 * Filters events based on specified criteria.
 *
 * @param events List of events to filter
 * @param criteria Filtering criteria
 * @return Filtered list of events
 */
fun filterEvents(events: List<Event>, criteria: FilterCriteria): List<Event>

API Documentation

  • Use OpenAPI/Swagger
  • Document all endpoints
  • Include request/response examples

Architecture Documentation

  • Keep diagrams updated
  • Document design decisions
  • Maintain changelog

Resources

Official Documentation

Style Guides

Useful Tools

RunOn Documentation

MVP Documentation

Core Documentation

Archived (Full-Featured)

Full-Featured Documentation

Clone this wiki locally