Dependencies Migration
Purpose
This document describes the technical migration of the SEIR Android application from GreenDAO to Room Database, along with the upgrade to the latest Android Gradle and SDK versions to ensure Android 15 (API 35) compatibility. It outlines the motivation, scope, architecture changes, migration strategy, risks, and validation steps.
1. Background
The SEIR application previously used GreenDAO as its local database solution. Over time, GreenDAO became less aligned with modern Android development practices and Jetpack components. Additionally, the project required an upgrade to the latest Android Gradle Plugin and SDK to support Android 15, improved performance, security, and long-term maintainability.
To address these needs, the application has been:
- Fully migrated from GreenDAO to Room Database
- Updated to the latest Android Gradle Plugin
- Upgraded to target Android 15 (API Level 35)
2. Objectives
- Replace GreenDAO with Room (Jetpack Persistence Library)
- Improve database safety using compile-time SQL validation
- Upgrade Gradle, Kotlin, and dependencies
- Ensure compatibility with Android 15
- Improve long-term maintainability and scalability
3. Technology Stack
Before Migration
- Language: Java
- Local Database: GreenDAO
- Gradle Plugin: Older version
- Target SDK: Below API 34
After Migration
- Language: Kotlin
- Local Database: Room Database
- Architecture: MVP
- Gradle Plugin: Latest stable version
- Target SDK: API 35 (Android 15)
- Min SDK: As per existing app support
4. Database Migration: GreenDAO → Room
4.1 Reasons for Migration
- GreenDAO is no longer actively evolving with latest gradle support
- Room provides:
- Compile-time query validation
- Built-in migration support
- Seamless integration with LiveData & Flow
- Better lifecycle awareness
4.2 Schema Mapping Strategy
Each GreenDAO entity was mapped to a Room entity:
| GreenDAO | Room |
|---|---|
| Entity | @Entity |
| Property | @ColumnInfo |
| DAO | @Dao |
| Database | @Database |
Primary keys, indices, and constraints were preserved to avoid data inconsistency.
4.3 Room Components Used
- Entities: Data models annotated with
@Entity - DAO Interfaces: Database access using
@Dao - RoomDatabase: Central database instance
- Migrations: Versioned migrations to retain existing user data
4.4 Data Migration Approach
- Database versioning introduced in Room
- Custom
Migrationclasses implemented - Existing tables recreated to match Room schema
- Data validated post-migration to ensure integrity
5. Gradle & Build System Upgrade
5.1 Gradle Changes
- Updated Android Gradle Plugin to latest stable version
- Updated Gradle Wrapper
- Enabled version catalogs (if applicable)
- Cleaned deprecated Gradle configurations
5.2 Dependency Updates
- Updated AndroidX libraries
- Updated Kotlin version
- Removed GreenDAO dependencies
- Added Room dependencies:
- room-runtime
- room-compiler (KAPT)
- room-ktx
6. Android 15 (API 35) Compatibility
6.1 SDK Configuration
compileSdkVersion: 35targetSdkVersion: 35
6.2 Compliance Updates
- Updated permission handling
- Reviewed background execution limits
- Addressed deprecated APIs
7. Architecture Impact
- Repository layer updated to use Room DAOs
- Presenters updated to consume Room-backed repositories
- Improved separation of concerns
- Better testability with Room in-memory database
8. Testing & Validation
8.1 Validation Criteria
- No data loss after migration
- App launches successfully on Android 15
- Database operations stable and performant
9. Risks & Mitigation
| Risk | Mitigation |
|---|---|
| Data loss | Controlled Room migrations |
| App crashes | Extensive regression testing |
| Performance issues | Optimized queries & indices |
10. Conclusion
The SEIR application has been successfully modernized by migrating from GreenDAO to Room Database and upgrading the build system to support Android 15. This transition ensures better performance, maintainability, safety, and future scalability while aligning the app with current Android development standards.