docs/contributing/development-environment.md
This guide will help you set up your development environment and get started with contributing to the Thunderbird for Android project.
Before you begin, ensure you have the following installed:
./gradlew); no separate install requiredAll contributions happen through a personal fork of the repository.
For the best development experience, we recommend the following settings:
app-thunderbird or app-k9mail) in the Run/Debug Configuration dropdownCtrl+F9 (Windows/Linux) or Cmd+F9 (macOS)A Gradle wrapper is included in the project, so you can build the project from the command line without installing
Gradle globally. Run the following commands from the root of the project, where ./gradlew is the Gradle wrapper script
and the command to build runs tests and other checks, while assemble only compiles the code and packages the APK.
# Build all variants
./gradlew assemble
./gradlew build
# Build debug or release variant
./gradlew assembleDebug
./gradlew assembleRelease
# Build a specific app module
./gradlew :app-thunderbird:assembleDebug
./gradlew :app-k9mail:assembleDebug
# Build a specific library/feature module
./gradlew :module-name:build
Replace module-name with the actual name of the module you want to build.
Shift+F10 (Windows/Linux) or Ctrl+R (macOS)# Run all tests across modules
./gradlew test
# Run unit tests for a specific module
./gradlew :module-name:test
# Run instrumented tests (device/emulator required)
./gradlew connectedAndroidTest
See the Testing Guide for details.
Maintaining high code quality is essential for the long-term sustainability of the Thunderbird for Android project. The project uses several tools and practices to ensure code quality:
To run the basic code quality checks:
# Run lint checks
./gradlew lint
# Run detekt
./gradlew detekt
# Check code formatting
./gradlew spotlessCheck
# Apply code formatting fixes
./gradlew spotlessApply
See the Code Quality Guide for more details.
Shift+F9 (Windows/Linux) or Ctrl+D (macOS)See the Android Studio Debugger Guide for a detailed description.
Use the project's core logging API net.thunderbird.core.logging.Logger, which is provided via dependency injection
(Koin). Avoid logging personally identifiable information (PII).
Example with DI (Koin):
private const val TAG = "ExampleActivity"
class ExampleActivity : ComponentActivity() {
private val logger: Logger by inject()
fun doSomething() {
logger.debug(tag = TAG) { "Debug message" }
try {
// Some code that might throw an exception
} catch (exception: Exception) {
logger.error(tag = TAG, throwable = exception) { "An error occurred" }
}
}
}
Use Android Studio's built-in Android Profiler to monitor:
For performance-sensitive code, also consider Baseline Profiles or Macrobenchmark tests.