Skip to content

Fix build #6#140

Merged
omeritzics merged 8 commits intomainfrom
dev
Feb 12, 2026
Merged

Fix build #6#140
omeritzics merged 8 commits intomainfrom
dev

Conversation

@omeritzics
Copy link
Owner

@omeritzics omeritzics commented Feb 12, 2026

PR Type

Bug fix


Description

  • Fixed incorrect compilerOptions to kotlinOptions in Gradle configuration

  • Corrected ABI filter type comparison from enum to string name


Diagram Walkthrough

flowchart LR
  A["build.gradle.kts"] -->|Fix compilerOptions| B["Use kotlinOptions"]
  A -->|Fix ABI filter| C["Use filterType.name == ABI"]
Loading

File Walkthrough

Relevant files
Bug fix
build.gradle.kts
Fix Kotlin options and ABI filter comparison                         

android/app/build.gradle.kts

  • Changed compilerOptions block to kotlinOptions for proper Kotlin
    compilation settings
  • Updated ABI filter type comparison from enum reference to string name
    comparison using filterType.name == "ABI"
+2/-2     

@gemini-code-assist
Copy link

Summary of Changes

Hello @omeritzics, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves build failures by updating the android/app/build.gradle.kts file. The changes address recent API modifications in the Android Gradle Plugin or Kotlin Gradle plugin, specifically concerning the configuration of Kotlin compiler options and the way ABI filters are accessed during the build process. These adjustments ensure the project can build successfully with the current toolchain.

Highlights

  • Build Configuration Update: Updated the android/app/build.gradle.kts file to reflect changes in Kotlin compiler options, switching from compilerOptions to kotlinOptions.
  • ABI Filter Access Adjustment: Modified the method of accessing ABI filters within the build.gradle.kts to use filterType.name == "ABI" for compatibility with updated Gradle plugin APIs.
Changelog
  • android/app/build.gradle.kts
    • Updated Kotlin compiler options from compilerOptions to kotlinOptions to align with newer Gradle/Kotlin plugin syntax.
    • Adjusted ABI filter logic from it.filterType == ABI to it.filterType.name == "ABI" for correct identification of ABI filters.
Activity
  • No specific activity has been recorded for this pull request since its creation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Feb 12, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@qodo-code-review
Copy link

qodo-code-review bot commented Feb 12, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to fix build issues in the Gradle configuration. The change from compilerOptions to kotlinOptions is correct for configuring the Kotlin compiler. However, the fix for the ABI filter comparison is incorrect. The filterType from the API being used is a String, so accessing the .name property on it will cause a build failure. I've provided a suggestion to correct this comparison.

@qodo-code-review
Copy link

qodo-code-review bot commented Feb 12, 2026

PR Code Suggestions ✨

Latest suggestions up to ce424a6

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix misplaced Kotlin DSL block

Move the kotlin { jvmToolchain(...) } block outside the android {} block, as it
is a top-level DSL element and its current placement will cause a build failure.

android/app/build.gradle.kts [42-44]

 kotlin {
     jvmToolchain(17)
 }
 
+android {
+    ...
+
+    kotlinOptions {
+        jvmTarget = JavaVersion.VERSION_17.toString()
+    }
+
+    ...
+}
+

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that the kotlin { jvmToolchain(17) } block is misplaced within the android block, which is a build-breaking error.

High
Incremental [*]
Fail fast on invalid version
Suggestion Impact:Replaced the silent fallback (?: 1L) with requireNotNull(...) and an explicit error message to fail fast on invalid flutterVersionCode.

code diff:

-                val baseBuildNumber = flutterVersionCode.toLongOrNull() ?: 1L
+                val baseBuildNumber = requireNotNull(flutterVersionCode.toLongOrNull()) {
+                    "Invalid flutter.versionCode='$flutterVersionCode' in local.properties; must be a number."
+                }

Fail the build if flutterVersionCode is malformed instead of silently falling
back to 1L to prevent unintended version code regressions.

android/app/build.gradle.kts [143]

-val baseBuildNumber = flutterVersionCode.toLongOrNull() ?: 1L
+val baseBuildNumber = requireNotNull(flutterVersionCode.toLongOrNull()) {
+    "Invalid flutter.versionCode='$flutterVersionCode' in local.properties; must be a number."
+}

[Suggestion processed]

Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that silently defaulting to 1L for a malformed flutterVersionCode can cause version downgrade issues, and proposes failing the build instead, which is a much more robust approach.

Medium
Clamp to Play version limits
Suggestion Impact:Replaced clamping upper bound from Int.MAX_VALUE.toLong() to a new maxPlayVersionCode constant set to 2_100_000_000L and used it in coerceIn.

code diff:

-                val safeVersionCode = compressedCode.coerceIn(1L, Int.MAX_VALUE.toLong())
+                val maxPlayVersionCode = 2_100_000_000L
+                val safeVersionCode = compressedCode.coerceIn(1L, maxPlayVersionCode)

Clamp the computed version code to the Google Play Store's practical upper bound
of 2,100,000,000 instead of Int.MAX_VALUE.

android/app/build.gradle.kts [145-146]

-val safeVersionCode = compressedCode.coerceIn(1L, Int.MAX_VALUE.toLong())
+val maxPlayVersionCode = 2_100_000_000L
+val safeVersionCode = compressedCode.coerceIn(1L, maxPlayVersionCode)
 output.versionCode.set(safeVersionCode.toInt())

[Suggestion processed]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly points out that the Google Play Store's maximum version code is lower than Int.MAX_VALUE, making the proposed clamping more accurate for preventing potential app store rejections.

Low
  • Update

Previous suggestions

✅ Suggestions up to commit 4c6f0af
CategorySuggestion                                                                                                                                    Impact
Possible issue
Remove stray duplicated build logic
Suggestion Impact:The commit removed the duplicated, out-of-scope leftover versionCode override block after the androidComponents closure, preventing the Gradle script from failing (and additionally improved version code parsing/safety).

code diff:

-        }
-    }
-}
-            val baseBuildNumber = flutterVersionCode.toLong()
-            val compressedCode = (baseBuildNumber % 100000) * 100 + abiVersionCode
-            (output as ApkVariantOutputImpl).versionCodeOverride = compressedCode.toInt()
         }

Remove the leftover, duplicated build logic from lines 150-153, which will cause
the Gradle script to fail.

android/app/build.gradle.kts [150-153]

 androidComponents {
     onVariants { variant ->
         variant.outputs.forEach { output ->
             val abiFilter = output.filters.find {
                 it.filterType == com.android.build.api.variant.VariantOutputConfiguration.FilterType.ABI
             }
             val abiVersionCode = abiFilter?.identifier?.let { abiCodes[it] }
 
             if (abiVersionCode != null) {
                 // Create a version code within Android limits (max 2100000000)
                 // Use: (YYMMDDHH % 100000) * 100 + ABI to stay well under limits
                 val baseBuildNumber = flutterVersionCode.toLong()
                 val compressedCode = (baseBuildNumber % 100000) * 100 + abiVersionCode
                 output.versionCode.set(compressedCode.toInt())
             }
         }
     }
 }
-            val baseBuildNumber = flutterVersionCode.toLong()
-            val compressedCode = (baseBuildNumber % 100000) * 100 + abiVersionCode
-            (output as ApkVariantOutputImpl).versionCodeOverride = compressedCode.toInt()
-        }
Suggestion importance[1-10]: 10

__

Why: This suggestion correctly identifies leftover code from a refactoring that will cause a build failure because it is syntactically incorrect and references variables that are out of scope.

High
Incremental [*]
Prevent version code parsing/overflow
Suggestion Impact:Replaced toLong() with toLongOrNull() fallback to 1L and added coerceIn clamping before converting to Int for output.versionCode.

code diff:

-                val baseBuildNumber = flutterVersionCode.toLong()
+                val baseBuildNumber = flutterVersionCode.toLongOrNull() ?: 1L
                 val compressedCode = (baseBuildNumber % 100000) * 100 + abiVersionCode
-                output.versionCode.set(compressedCode.toInt())
+                val safeVersionCode = compressedCode.coerceIn(1L, Int.MAX_VALUE.toLong())
+                output.versionCode.set(safeVersionCode.toInt())

Use toLongOrNull() to safely parse flutterVersionCode and add clamping to
prevent potential crashes from invalid version codes or overflow.

android/app/build.gradle.kts [143-145]

-val baseBuildNumber = flutterVersionCode.toLong()
+val baseBuildNumber = flutterVersionCode.toLongOrNull() ?: 1L
 val compressedCode = (baseBuildNumber % 100000) * 100 + abiVersionCode
-output.versionCode.set(compressedCode.toInt())
+val safeVersionCode = compressedCode.coerceIn(1L, Int.MAX_VALUE.toLong())
+output.versionCode.set(safeVersionCode.toInt())

[Suggestion processed]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a potential NumberFormatException if flutterVersionCode is not a valid number and proposes a robust fix using toLongOrNull(), which prevents the build from crashing.

Low
✅ Suggestions up to commit 53a7db1
CategorySuggestion                                                                                                                                    Impact
General
Use modern Android Gradle Plugin API
Suggestion Impact:The commit did not migrate to androidComponents, but it did apply a small part of the suggestion by changing the ABI filter predicate from `it.filterType.name == "ABI"` to `it.filterType == "ABI"` within the existing `android.applicationVariants` block.

code diff:

 android.applicationVariants.configureEach {
     val variant = this
     variant.outputs.forEach { output ->
-        val abiVersionCode = abiCodes[output.filters.find { it.filterType.name == "ABI" }?.identifier]
+        val abiVersionCode = abiCodes[output.filters.find { it.filterType == "ABI" }?.identifier]
         if (abiVersionCode != null) {

Replace the deprecated android.applicationVariants API with the modern
androidComponents API to improve build script stability and future-proof the
code.

android/app/build.gradle.kts [133-145]

-android.applicationVariants.configureEach {
-    val variant = this
+androidComponents.onVariants { variant ->
     variant.outputs.forEach { output ->
--        val abiVersionCode = abiCodes[output.filters.find { it.filterType == ABI }?.identifier]
-+        val abiVersionCode = abiCodes[output.filters.find { it.filterType.name == "ABI" }?.identifier]
-        if (abiVersionCode != null) {
-            // Create a version code within Android limits (max 2100000000)
-            // Use: (YYMMDDHH % 100000) * 100 + ABI to stay well under limits
-            val baseBuildNumber = flutterVersionCode.toLong()
-            val newVersionCode = (baseBuildNumber % 100000) * 100 + abiVersionCode
-            (output as ApkVariantOutputImpl).versionCodeOverride = newVersionCode.toInt()
+        val abiFilter = output.filters.find { it.filterType == "ABI" }
+        if (abiFilter != null) {
+            val abiVersionCode = abiCodes[abiFilter.identifier]
+            if (abiVersionCode != null) {
+                // Create a version code within Android limits (max 2100000000)
+                // Use: (YYMMDDHH % 100000) * 100 + ABI to stay well under limits
+                val baseBuildNumber = flutterVersionCode.toLong()
+                val newVersionCode = (baseBuildNumber % 100000) * 100 + abiVersionCode
+                output.versionCode.set(newVersionCode.toInt())
+            }
         }
     }
 }

[Suggestion processed]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies the use of a deprecated android.applicationVariants API and proposes migrating to the modern androidComponents API, which is a significant improvement for future compatibility and maintainability.

Medium
Configure Kotlin compile options via tasks API
Suggestion Impact:The kotlinOptions jvmTarget configuration was removed and replaced with Kotlin toolchain configuration (kotlin { jvmToolchain(17) }), changing how the Kotlin JVM target is set, though not using the suggested tasks.withType() pattern.

code diff:

-    kotlinOptions {
-        jvmTarget = JavaVersion.VERSION_17.toString()
+    kotlin {
+        jvmToolchain(17)
     }

Move the kotlinOptions configuration into a tasks.withType() block to align with
a different configuration pattern for Kotlin projects.

android/app/build.gradle.kts [42-44]

-kotlinOptions {
-    jvmTarget = JavaVersion.VERSION_17.toString()
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+...
+tasks.withType<KotlinCompile>().configureEach {
+    kotlinOptions {
+        jvmTarget = JavaVersion.VERSION_17.toString()
+    }
 }
Suggestion importance[1-10]: 3

__

Why: The suggestion proposes an alternative way to configure Kotlin options, but the existing code within the android block is a valid and common practice, so this change is more of a stylistic preference than a necessary correction.

Low
Possible issue
Pin Kotlin to JDK 17
Suggestion Impact:Updated the Gradle Kotlin configuration to use jvmToolchain(17) instead of setting kotlinOptions.jvmTarget.

code diff:

-    kotlinOptions {
-        jvmTarget = JavaVersion.VERSION_17.toString()
+    kotlin {
+        jvmToolchain(17)
     }

Replace kotlinOptions.jvmTarget with kotlin { jvmToolchain(17) } to reliably pin
the Kotlin compiler to JDK 17 and ensure consistent build behavior.

android/app/build.gradle.kts [42-44]

-kotlinOptions {
-    jvmTarget = JavaVersion.VERSION_17.toString()
+kotlin {
+    jvmToolchain(17)
 }

[Suggestion processed]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly recommends using jvmToolchain which is the modern best practice for ensuring a consistent JDK is used for Kotlin compilation, improving build reliability over just setting jvmTarget.

Medium

omeritzics and others added 3 commits February 12, 2026 23:36
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
@omeritzics
Copy link
Owner Author

PR Code Suggestions ✨

Latest suggestions up to 4c6f0af
Category **Suggestion ** Impact
Possible issue
Remove stray duplicated build logic

High
Incremental [*]
✅ Prevent version code parsing/overflow

Low

* [ ]  Update

Previous suggestions

✅ Suggestions up to commit 53a7db1

Running Gradle task 'assembleNormalDebug'...
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:153:9: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:154:5: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:155:1: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:158:1: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:158:14: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:159:5: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:159:26: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:159:27: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:159:28: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:159:68: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:159:69: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:160:1: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:162:1: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:162:9: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:163:5: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:163:12: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:163:14: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:163:15: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:163:20: Unexpected symbol
e: file:///home/runner/work/Updatium/Updatium/android/app/build.gradle.kts:164:1: Unexpected symbol

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/runner/work/Updatium/Updatium/android/app/build.gradle.kts' line: 153

  • What went wrong:
    Script compilation errors:

    Line 153: }
    ^ Unexpected symbol

    Line 154: }
    ^ Unexpected symbol

    Line 155: }
    ^ Unexpected symbol

    Line 158: dependencies {
    ^ Unexpected symbol

    Line 158: dependencies {
    ^ Unexpected symbol

    Line 159: coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
    ^ Unexpected symbol

    Line 159: coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
    ^ Unexpected symbol

    Line 159: coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
    ^ Unexpected symbol

    Line 159: coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
    ^ Unexpected symbol

    Line 159: coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
    ^ Unexpected symbol

    Line 159: coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
    ^ Unexpected symbol

    Line 160: }
    ^ Unexpected symbol

    Line 162: flutter {
    ^ Unexpected symbol

    Line 162: flutter {
    ^ Unexpected symbol

    Line 163: source = "../.."
    ^ Unexpected symbol

    Line 163: source = "../.."
    ^ Unexpected symbol

    Line 163: source = "../.."
    ^ Unexpected symbol

    Line 163: source = "../.."
    ^ Unexpected symbol

    Line 163: source = "../.."
    ^ Unexpected symbol

    Line 164: }
    ^ Unexpected symbol

20 errors

What's happened there?

Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
@omeritzics
Copy link
Owner Author

PR Code Suggestions ✨

Latest suggestions up to ce424a6
Category **Suggestion ** Impact
Possible issue
Fix misplaced Kotlin DSL block

Move the kotlin { jvmToolchain(...) } block outside the android {} block, as it is a top-level DSL element and its current placement will cause a build failure.

android/app/build.gradle.kts [42-44]

 kotlin {
     jvmToolchain(17)
 }
 
+android {
+    ...
+
+    kotlinOptions {
+        jvmTarget = JavaVersion.VERSION_17.toString()
+    }
+
+    ...
+}
+

[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that the kotlin { jvmToolchain(17) } block is misplaced within the android block, which is a build-breaking error.
High
Incremental [*]
Fail fast on invalid version

Medium
✅ Clamp to Play version limits

Low

* [ ]  Update

Previous suggestions

✅ Suggestions up to commit 4c6f0af

✅ Suggestions up to commit 53a7db1

Please implement kotlin {
jvmToolchain(17)
}

+android {

  • ...
  • kotlinOptions {
  •    jvmTarget = JavaVersion.VERSION_17.toString()
    
  • }
  • ...
    +}

@omeritzics omeritzics merged commit d4717c4 into main Feb 12, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant