Prerequisites
Before you begin, ensure you have the following installed:Android Studio
Hedgehog (2023.1.1) or newer
JDK
Java Development Kit 11 or higher
Kotlin
Kotlin 2.2.10 (handled by Gradle)
Android SDK
API Level 33+ (Android 13)
Initial Setup
1. Clone the Repository
2. Open in Android Studio
- Launch Android Studio
- Select Open an Existing Project
- Navigate to the cloned
EnvaSistemadirectory - Click OK
Android Studio will automatically detect the Gradle configuration and begin syncing dependencies. This may take several minutes on the first run.
3. Configure SDK
Ensure the required SDK components are installed:Project Configuration
Gradle Version Catalog
EnvaSistema uses Gradle’s version catalog for dependency management. All versions are centralized in:gradle/libs.versions.toml
Build Configuration
The app module is configured inapp/build.gradle.kts:
app/build.gradle.kts
Building the Project
Sync Gradle
After any configuration changes:Clean Build
Debug Build
Release Build
Release builds require signing configuration. See the Signing Configuration section below.
Running the App
Using Android Studio
- Connect an Android device via USB or launch an emulator
- Click the Run button (green play icon) or press
Shift + F10 - Select your target device from the dropdown
- Wait for the app to install and launch
Using Command Line
Development Tools
Jetpack Compose Preview
EnvaSistema components include@Preview annotations for rapid UI development:
Layout Inspector
Debug your Compose UI hierarchy:- Run the app on a device/emulator
- Go to Tools → Layout Inspector
- Select your app process
- Explore the component tree and properties
Logcat
View runtime logs:EnvaSistema.
Code Style
Kotlin Style Guide
EnvaSistema follows the official Kotlin Coding Conventions. Key conventions:- Indentation: 4 spaces
- Line length: Max 120 characters
- Naming:
- Classes:
PascalCase - Functions:
camelCase - Constants:
UPPER_SNAKE_CASE - Composables:
PascalCase
- Classes:
Format Code
Format code automatically:- Windows/Linux:
Ctrl + Alt + L - macOS:
Cmd + Option + L
Testing
Unit Tests
Run unit tests:Instrumented Tests
Run instrumented tests on a device:Compose UI Tests
Example Compose test:Debugging
Breakpoints
Set breakpoints in Kotlin code:- Click the gutter next to a line number
- Run the app in Debug mode (
Shift + F9) - The app will pause at breakpoints
Compose Recomposition Debugging
Enable recomposition highlighting:Signing Configuration
Debug Signing
Debug builds are automatically signed with a debug keystore.Release Signing
For production releases, configure signing:-
Create a keystore:
-
Add to
app/build.gradle.kts:
Troubleshooting
Gradle Sync Failed
Gradle Sync Failed
Solution:
- Check internet connection
- Invalidate caches: File → Invalidate Caches / Restart
- Delete
.gradleand.ideafolders, then re-sync - Verify JDK version matches project requirements
Compose Preview Not Showing
Compose Preview Not Showing
Solution:
- Ensure you’re in Split or Design mode
- Check that the function is annotated with
@Preview - Rebuild the project: Build → Rebuild Project
- Restart Android Studio
App Crashes on Launch
App Crashes on Launch
Solution:
- Check Logcat for exceptions
- Verify device API level meets minSdk (33+)
- Uninstall and reinstall the app
- Clear app data from device settings
Dependency Resolution Errors
Dependency Resolution Errors
Solution:
- Check
gradle/libs.versions.tomlfor version conflicts - Update Gradle wrapper:
./gradlew wrapper --gradle-version=8.5 - Sync project after changes
- Review build output for specific error messages
Development Workflow
Recommended Workflow
IDE Configuration
Recommended Plugins
Kotlin
Core Kotlin language support (bundled)
Compose Multiplatform
Enhanced Compose tooling
ADB Idea
Quick ADB commands from IDE
Material Theme UI
Better IDE theming
Editor Settings
Configure Android Studio for optimal development:-
Editor → Code Style → Kotlin
- Set indent to 4 spaces
- Enable auto-format on save
-
Editor → Inspections
- Enable Kotlin inspections
- Enable Compose-specific warnings
-
Build, Execution, Deployment → Compiler
- Enable parallel compilation
- Increase heap size to 4GB for faster builds
Performance Optimization
Build Performance
Optimize build times:gradle.properties
Compose Performance
- Use
rememberto avoid unnecessary recompositions - Leverage
derivedStateOffor computed state - Profile with Compose Layout Inspector
Resources
Kotlin Docs
Official Kotlin documentation
Jetpack Compose
Compose guides and references
Material 3
Material Design 3 guidelines
Android Studio
IDE documentation
Next Steps
Architecture
Understand the app architecture
UI Components
Learn about reusable components