Migrate to Android Gradle Plugin 9 and upgrade packages#60
Migrate to Android Gradle Plugin 9 and upgrade packages#60
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request performs a major architectural migration from Hilt to Koin for dependency injection, alongside updating the project to Gradle 9 and Android Gradle Plugin 9.0.1. The PR also downgrades Java/Kotlin target from version 21 to 17, updates numerous dependencies, replaces Material Icons with custom vector drawables, and adds multiple Gradle configuration properties.
Changes:
- Complete migration from Hilt to Koin dependency injection framework with corresponding updates to all ViewModels, repositories, and the Application class
- Major version updates: Gradle 8.14.3 → 9.3.1, Android Gradle Plugin 8.11.1 → 9.0.1, Kotlin 2.2.0 → 2.3.10, and multiple AndroidX libraries
- Java/Kotlin compile target downgraded from version 21 to 17 for broader compatibility
- Replaced Material Icons with custom vector drawable resources for check and info icons
- Added 10 new Gradle configuration properties to gradle.properties
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| gradle/wrapper/gradle-wrapper.properties | Updates Gradle wrapper from 8.14.3 to 9.3.1 |
| gradle/libs.versions.toml | Updates multiple dependency versions and replaces Hilt dependencies with Koin |
| gradle.properties | Adds 10 new Gradle configuration properties for build behavior |
| build.gradle.kts | Removes Hilt plugin from root build file |
| app/build.gradle.kts | Removes Hilt dependencies and kapt plugin, adds Koin dependencies, downgrades Java/Kotlin to version 17 |
| app/src/main/res/drawable/ic_info.xml | Adds new custom info icon vector drawable |
| app/src/main/res/drawable/ic_check.xml | Adds new custom check icon vector drawable |
| app/src/main/java/com/rickyhu/hushkeyboard/settings/ui/AppVersionItem.kt | Replaces Material Icons with custom drawable resource |
| app/src/main/java/com/rickyhu/hushkeyboard/settings/SettingsViewModel.kt | Removes Hilt annotations, updates to Koin constructor injection |
| app/src/main/java/com/rickyhu/hushkeyboard/settings/SettingsScreen.kt | Replaces hiltViewModel() with koinViewModel() |
| app/src/main/java/com/rickyhu/hushkeyboard/service/HushIMEService.kt | Removes Hilt, adds manual ViewModel instantiation with custom factory and Koin repository injection |
| app/src/main/java/com/rickyhu/hushkeyboard/main/MainViewModel.kt | Removes Hilt annotations, updates to standard constructor |
| app/src/main/java/com/rickyhu/hushkeyboard/main/MainApp.kt | Replaces hiltViewModel() with koinViewModel() |
| app/src/main/java/com/rickyhu/hushkeyboard/keyboard/KeyboardViewModelFactory.kt | Adds new custom ViewModelFactory for manual ViewModel creation in IME service |
| app/src/main/java/com/rickyhu/hushkeyboard/keyboard/KeyboardViewModel.kt | Removes Hilt annotations, updates to standard constructor |
| app/src/main/java/com/rickyhu/hushkeyboard/introduction/Step3Section.kt | Replaces Material Icons with custom drawable resource |
| app/src/main/java/com/rickyhu/hushkeyboard/di/AppModule.kt | Creates new Koin module defining all dependency injection bindings |
| app/src/main/java/com/rickyhu/hushkeyboard/data/SettingsRepository.kt | Removes Hilt annotations, updates to standard constructor |
| app/src/main/java/com/rickyhu/hushkeyboard/MainActivity.kt | Removes Hilt @AndroidEntryPoint annotation |
| app/src/main/java/com/rickyhu/hushkeyboard/HushApplication.kt | Removes Hilt, adds Koin initialization with module setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,5 @@ | |||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp"> | |||
There was a problem hiding this comment.
The XML formatting is inconsistent. The vector tag has all attributes on a single line making it difficult to read, while ic_info.xml has properly formatted attributes on separate lines. For consistency and maintainability, please format the attributes on separate lines as done in ic_info.xml.
| <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp"> | |
| <vector | |
| xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:height="24dp" | |
| android:tint="#000000" | |
| android:viewportHeight="960" | |
| android:viewportWidth="960" | |
| android:width="24dp"> |
| viewModel = | ||
| ViewModelProvider( | ||
| owner = this, | ||
| factory = KeyboardViewModelFactory(settingsRepository), | ||
| )[KeyboardViewModel::class.java] |
There was a problem hiding this comment.
KeyboardViewModel is registered in the Koin module (AppModule.kt line 16) but is also being instantiated manually using a custom ViewModelFactory in HushIMEService. This creates two different instantiation paths for the same ViewModel, which could lead to confusion and maintenance issues. Consider whether the Koin registration is actually used anywhere, or if the manual factory approach is necessary due to IME service lifecycle constraints. If the Koin registration is not used, it should be removed to avoid confusion.
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 |
There was a problem hiding this comment.
The Java version has been downgraded from 21 to 17. While this increases compatibility, please ensure this change is intentional and necessary. Java 21 is the latest LTS version and offers significant performance and feature improvements. If the downgrade is required for specific compatibility reasons, those reasons should be documented in the PR description or commit message.
| android.nonTransitiveRClass=true | ||
| android.defaults.buildfeatures.resvalues=true | ||
| android.sdk.defaultTargetSdkToCompileSdkIfUnset=false | ||
| android.enableAppCompileTimeRClass=false | ||
| android.usesSdkInManifest.disallowed=false | ||
| android.uniquePackageNames=false | ||
| android.dependency.useConstraints=true | ||
| android.r8.strictFullModeForKeepRules=false | ||
| android.r8.optimizedResourceShrinking=false | ||
| android.builtInKotlin=false |
There was a problem hiding this comment.
Multiple new Gradle properties have been added without documentation or explanation. Some of these properties (like android.newDsl=false, android.builtInKotlin=false) explicitly disable new features, which may impact future compatibility and migration paths. Consider adding comments explaining why each property is set to its specific value, especially for properties that disable newer features.
| android.nonTransitiveRClass=true | |
| android.defaults.buildfeatures.resvalues=true | |
| android.sdk.defaultTargetSdkToCompileSdkIfUnset=false | |
| android.enableAppCompileTimeRClass=false | |
| android.usesSdkInManifest.disallowed=false | |
| android.uniquePackageNames=false | |
| android.dependency.useConstraints=true | |
| android.r8.strictFullModeForKeepRules=false | |
| android.r8.optimizedResourceShrinking=false | |
| android.builtInKotlin=false | |
| android.nonTransitiveRClass=true | |
| # Explicitly enable generation of resValues via the buildFeatures DSL to keep legacy | |
| # resource value handling behavior stable across Android Gradle Plugin upgrades. | |
| android.defaults.buildfeatures.resvalues=true | |
| # Do not automatically default targetSdkVersion to compileSdkVersion to ensure the | |
| # app's targetSdkVersion remains explicitly controlled in the Gradle configuration. | |
| android.sdk.defaultTargetSdkToCompileSdkIfUnset=false | |
| # Keep the R class generated at build time to avoid changing resource access patterns | |
| # in existing code and to reduce risk during migration to newer AGP versions. | |
| android.enableAppCompileTimeRClass=false | |
| # Allow uses-sdk to be declared in the AndroidManifest for backward compatibility | |
| # with existing manifests that rely on this behavior. | |
| android.usesSdkInManifest.disallowed=false | |
| # Do not enforce unique applicationId/packageName across all modules to maintain | |
| # compatibility with current module and package naming schemes. | |
| android.uniquePackageNames=false | |
| # Use dependency constraints to ensure consistent versions across modules and avoid | |
| # accidental dependency version drift in the project. | |
| android.dependency.useConstraints=true | |
| # Do not enable strict R8 full mode for keep rules to avoid potentially aggressive | |
| # shrinking and obfuscation changes that could break existing code paths. | |
| android.r8.strictFullModeForKeepRules=false | |
| # Keep R8 optimized resource shrinking disabled to preserve current resource packaging | |
| # behavior and reduce the risk of inadvertently removing required resources. | |
| android.r8.optimizedResourceShrinking=false | |
| # Disable the built-in Kotlin integration in AGP; Kotlin configuration is managed | |
| # explicitly via the Kotlin Gradle plugin to keep build configuration centralized. | |
| android.builtInKotlin=false | |
| # Disable the new Gradle Android DSL to avoid unexpected breaking changes in the | |
| # build scripts and to allow a controlled, explicit migration when ready. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #60 +/- ##
==========================================
+ Coverage 53.15% 53.89% +0.74%
==========================================
Files 39 40 +1
Lines 999 950 -49
Branches 84 85 +1
==========================================
- Hits 531 512 -19
+ Misses 432 402 -30
Partials 36 36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
This pull request migrates the project's dependency injection framework from Hilt to Koin, updates several dependencies and Gradle configuration, and replaces Material Icons with custom vector drawables. The most significant changes are the removal of Hilt, introduction of Koin for dependency injection, code and configuration updates to support this migration, and minor UI improvements.
Dependency Injection Migration:
appModulefor Koin, and updated application and ViewModel initialization to use Koin [1] [2] [3] [4] [5] [6].ViewModel and Repository Refactoring:
KeyboardViewModelFactoryfor cases where ViewModelProvider is used directly [1] [2] [3].UI and Resource Updates:
Icons.Default) with custom vector drawable resources for check and info icons, and updated relevant Compose UI code to usepainterResource[1] [2] [3] [4] [5] [6] [7].Gradle and Dependency Updates:
Build Configuration Improvements:
gradle.propertiesfor improved build behavior and compatibility.These changes collectively modernize the project, simplify dependency management, and improve maintainability by adopting Koin and updating dependencies.