Use newer Android, Gradle and Java versions#122
Use newer Android, Gradle and Java versions#122JohanPy wants to merge 2 commits intoVincentAudibert:masterfrom
Conversation
…, and migrate to View Binding.
Bump Android Application plugin version to 8.13.2 Update Java bytecode target level to 21
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Android project by upgrading to newer Android SDK versions (35), Java 17/21, Gradle 8.13, and refactoring all fragments to use View Binding instead of deprecated Kotlin synthetic imports. The changes address warnings from F-droid and Play Protect on newer Android versions.
Changes:
- Updated project to Android SDK 35, Gradle 8.13, and replaced deprecated build plugins (kotlin-android-extensions, kapt) with modern alternatives (org.jetbrains.kotlin.android, ksp)
- Migrated all fragments and MainActivity to use View Binding pattern with proper memory leak prevention through onDestroyView cleanup
- Updated dependencies to latest stable versions for AndroidX libraries, Room, Navigation, and JUnit; modernized Gradle configuration structure
Reviewed changes
Copilot reviewed 12 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| build.gradle.kts | Modernized plugin configuration using plugins DSL instead of buildscript block |
| app/build.gradle.kts | Updated to SDK 35, Java 17, enabled View Binding, replaced kapt with ksp, updated all dependencies |
| settings.gradle.kts | Added modern Gradle configuration with plugin and dependency management |
| gradlew | Updated Gradle wrapper script to newer version |
| gradle/wrapper/gradle-wrapper.properties | Updated Gradle version from 6.1.1 to 8.13 |
| app/src/main/AndroidManifest.xml | Added android:exported="true" for MainActivity (required for SDK 31+) |
| app/src/main/res/layout/activity_main.xml | Replaced deprecated fragment tag with FragmentContainerView |
| MainActivity.kt | Migrated to View Binding from synthetic imports |
| SplashFragment.kt | Migrated to View Binding with proper cleanup in onDestroyView |
| EditPresetFragment.kt | Migrated to View Binding, fixed DoubleArray.indexOf() usage by converting to List |
| DriveFragment.kt | Migrated to View Binding, replaced context!! with requireContext() |
| DrinkerFragment.kt | Migrated to View Binding, replaced wildcard imports with explicit imports |
| AddDrinkFragment.kt | Migrated to View Binding, updated Observer syntax to lambda |
| .idea/* | Updated IDE configuration for Java 21 and Gradle settings |
Files not reviewed (7)
- .idea/AndroidProjectSystem.xml: Language not supported
- .idea/compiler.xml: Language not supported
- .idea/deploymentTargetSelector.xml: Language not supported
- .idea/gradle.xml: Language not supported
- .idea/migrations.xml: Language not supported
- .idea/misc.xml: Language not supported
- .idea/runConfigurations.xml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # | ||
| # Busybox and similar reduced functionality shells will NOT work, | ||
| # because this script at least requires all of the following | ||
| # POSIX://p shell features: |
There was a problem hiding this comment.
The comment contains malformed text "POSIX://p" which should be "POSIX" only. This appears to be a text corruption issue.
| # | ||
| # Important for patching: | ||
| # | ||
| # (2) This script targets any POSIX://p shell, so it avoid extensions |
There was a problem hiding this comment.
The comment contains malformed text "POSIX://p" which should be "POSIX" only. This appears to be a text corruption issue.
| if | ||
| case $arg in #( | ||
| -*) false ;; # don't mess with options #( | ||
| /?*) t=${arg#)}; t=/${t%%/*} # looks like a POSIX://p filepath |
There was a problem hiding this comment.
The comment contains malformed text "POSIX://p" which should be "POSIX" only. This appears to be a text corruption issue.
| # * DEFAULT_JVM_OPTS, JAVA_OPTS, GRADLE_OPTS, and optsEnvironmentVar are not://p | ||
| # temporary values we need to pass arguments. | ||
| # * To://p avoid://p://p://p collisions://p, we://p use://p://p "{@Q}" instead of "$@" | ||
| # * expand://p://p arguments://p from://p build://p.gradle etc. |
There was a problem hiding this comment.
The comments contain multiple instances of malformed text patterns like "not://p", "To://p", "avoid://p://p://p", "collisions://p", "we://p", "use://p://p", and others. These appear to be text corruption issues where colons and slashes were incorrectly inserted into normal words. The text should read naturally without these artifacts.
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
| } | ||
| (kotlinOptions as org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions).apply { | ||
| jvmTarget = JavaVersion.VERSION_1_8.toString() | ||
|
|
||
| kotlinOptions { | ||
| jvmTarget = "17" |
There was a problem hiding this comment.
There's an inconsistency between the IDE Java version configuration and the Gradle build configuration. The IDE is configured to use JDK 21 (in .idea/misc.xml line 4), but the Gradle build is targeting Java 17 (sourceCompatibility and targetCompatibility in app/build.gradle.kts lines 38-39, and kotlinOptions jvmTarget line 43). While this may work, it can lead to confusion and potential issues. Consider either updating the Gradle configuration to use Java 21, or aligning the IDE configuration to Java 17 for consistency.
| if | ||
| case $arg in #( | ||
| -*) false ;; # don't mess with options #( | ||
| /?*) t=${arg#)}; t=/${t%%/*} # looks like a POSIX://p filepath |
There was a problem hiding this comment.
There's a syntax error in the shell script. The parameter expansion is malformed as "${arg#)}" but should be "${arg#/}" to remove the leading forward slash from the argument.
| /?*) t=${arg#)}; t=/${t%%/*} # looks like a POSIX://p filepath | |
| /?*) t=${arg#/}; t=/${t%%/*} # looks like a POSIX://p filepath |
| org.gradle.wrapper.GradleWrapperMain \ | ||
| "$@" | ||
|
|
||
| # Stop when "xeli" is set, since we may be sourced. |
There was a problem hiding this comment.
The comment mentions stopping when "xeli" is set, but this appears to be a typo or corrupted text. This should likely say "xtrace" or reference another shell option. The comment doesn't match the actual code which just unsets CDPATH.
| # Stop when "xeli" is set, since we may be sourced. | |
| # Unset CDPATH to avoid unexpected 'cd' behavior, especially if the script is sourced. |
F-droid and Play Protect display warnings on the new version of Android, so I updated the code to make it compatible.
This pull request updates the project to use newer Android and Java versions, modernizes Gradle and dependency configurations, and refactors fragments to use View Binding instead of synthetic view references. These changes improve compatibility, maintainability, and code safety.
Project configuration and environment updates:
.idea/misc.xml,.idea/compiler.xml,app/build.gradle.kts), including switching to Java 21 and Android SDK 35. [1] [2] [3]Dependency and plugin modernization:
kotlin-android-extensionsandkapt) with recommended alternatives (org.jetbrains.kotlin.androidandcom.google.devtools.ksp).Refactoring to View Binding:
MainActivity,AddDrinkFragment, andDrinkerFragmentto use View Binding for safer and more maintainable view access, replacing synthetic imports and direct view references. [1] [2] [3] [4] [5] [6] [7]Manifest and navigation improvements:
AndroidManifest.xmlto setandroid:exported="true"forMainActivityand cleaned up the manifest structure for compliance with newer Android requirements. [1] [2]