This file serves as a comprehensive guide for AI agents and developers working on the `Meshtastic-Android` codebase. Use this as your primary reference for understanding the architecture, conventions, and workflows.
## 1. Project Overview
-**Type:** Native Android Application (Kotlin).
-**Purpose:** Client interface for Meshtastic mesh radios.
-**Architecture:** Modern Android Development (MAD) principles.
-**UI:** Jetpack Compose (Material 3).
-**State Management:** Unidirectional Data Flow (UDF) with ViewModels, Coroutines, and Flow.
1.**Explore First:** Before making changes, read `gradle/libs.versions.toml` and the relevant `build.gradle.kts` to understand the environment.
2.**Plan:** Identify which modules (`core` or `feature`) need modification.
3.**Implement:**
- If adding a string, modify `core/strings`.
- If adding a dependency, modify `libs.versions.toml` first.
4.**Verify:**
- Run `./gradlew spotlessApply` (Essential!).
- Run `./gradlew detekt`.
- Run relevant tests (e.g., `./gradlew :feature:settings:testDebugUnitTest`).
## 6. Important Context
-**Protobuf:** Communication with the device uses Protobufs. The definitions are in `core/proto`. This is a Git submodule, but the build system handles it.
-**Legacy:** Some code in `app/` uses the `com.geeksville.mesh` package. Newer code in `core/` and `feature/` uses `org.meshtastic.*`. Respect the existing package structure of the file you are editing.
-**Versioning:** Do not manually edit `versionCode` or `versionName`. These are managed by the build system and CI/CD.
-**Database Safety:** When modifying critical database logic (e.g., `NodeInfoDao`), always ensure you have explicit test coverage for security edge cases (like PKC conflicts or key wiping). Refer to `core/database/src/androidTest/kotlin/org/meshtastic/core/database/dao/NodeInfoDaoTest.kt` for examples.
-**Missing Strings:** If `Res.string.xyz` is unresolved, ensure you have imported `org.meshtastic.core.strings.Res` and the specific string property, and that you have run a build to generate the resources.
-**Build Errors:** Check `gradle/libs.versions.toml` for version conflicts. Use `build-logic` conventions to ensure plugins are applied correctly.
---
*Refer to `CONTRIBUTING.md` for human-centric processes like Code of Conduct and Pull Request etiquette.*