Skip to content

Use newer Android, Gradle and Java versions#122

Open
JohanPy wants to merge 2 commits intoVincentAudibert:masterfrom
JohanPy:master
Open

Use newer Android, Gradle and Java versions#122
JohanPy wants to merge 2 commits intoVincentAudibert:masterfrom
JohanPy:master

Conversation

@JohanPy
Copy link

@JohanPy JohanPy commented Jan 17, 2026

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:

  • Upgraded Java and Android versions in project settings and Gradle files (.idea/misc.xml, .idea/compiler.xml, app/build.gradle.kts), including switching to Java 21 and Android SDK 35. [1] [2] [3]
  • Updated Gradle settings to use local Java home and improved test runner configuration. Added migration tracking for Gradle local Java home. [1] [2]

Dependency and plugin modernization:

  • Updated dependencies to latest versions for AndroidX libraries, Room, Navigation, and JUnit. Replaced deprecated plugins (kotlin-android-extensions and kapt) with recommended alternatives (org.jetbrains.kotlin.android and com.google.devtools.ksp).

Refactoring to View Binding:

  • Refactored MainActivity, AddDrinkFragment, and DrinkerFragment to 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:

  • Updated AndroidManifest.xml to set android:exported="true" for MainActivity and cleaned up the manifest structure for compliance with newer Android requirements. [1] [2]

Bump Android Application plugin version to 8.13.2
Update Java bytecode target level to 21
Copilot AI review requested due to automatic review settings January 17, 2026 16:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment contains malformed text "POSIX://p" which should be "POSIX" only. This appears to be a text corruption issue.

Copilot uses AI. Check for mistakes.
#
# Important for patching:
#
# (2) This script targets any POSIX://p shell, so it avoid extensions
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment contains malformed text "POSIX://p" which should be "POSIX" only. This appears to be a text corruption issue.

Copilot uses AI. Check for mistakes.
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#)}; t=/${t%%/*} # looks like a POSIX://p filepath
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment contains malformed text "POSIX://p" which should be "POSIX" only. This appears to be a text corruption issue.

Copilot uses AI. Check for mistakes.
Comment on lines +196 to +199
# * 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.
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +43
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"
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#)}; t=/${t%%/*} # looks like a POSIX://p filepath
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
/?*) t=${arg#)}; t=/${t%%/*} # looks like a POSIX://p filepath
/?*) t=${arg#/}; t=/${t%%/*} # looks like a POSIX://p filepath

Copilot uses AI. Check for mistakes.
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xeli" is set, since we may be sourced.
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# Stop when "xeli" is set, since we may be sourced.
# Unset CDPATH to avoid unexpected 'cd' behavior, especially if the script is sourced.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant