Skip to content

Update Android Gradle Plugin to 9#3259

Draft
alexvanyo wants to merge 3 commits into
mainfrom
av/agp-9
Draft

Update Android Gradle Plugin to 9#3259
alexvanyo wants to merge 3 commits into
mainfrom
av/agp-9

Conversation

@alexvanyo
Copy link
Copy Markdown
Owner

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 primarily focuses on upgrading the project's build system to Android Gradle Plugin (AGP) version 9.1.0. This major version bump necessitated a comprehensive refactoring of the custom Gradle convention plugins and module-level build scripts to adapt to the new AGP APIs and updated Kotlin Multiplatform configurations. The changes streamline the build process and ensure compatibility with the latest Android development tools.

Highlights

  • Android Gradle Plugin Update: The Android Gradle Plugin (AGP) has been updated to version 9.1.0, along with corresponding Android Tools updates.
  • Build Logic Refactoring for AGP 9: The build logic in convention plugins has been extensively refactored to align with the API changes introduced in AGP 9, including updates to CommonExtension and TestedExtension types.
  • Kotlin Multiplatform (KMP) Configuration Adjustments: KMP build configurations have been significantly adjusted, including the removal of the kotlinMultiplatform plugin from individual modules and changes to how Kotlin source sets and compiler options are configured within convention plugins.
  • Android Source Set Renaming: Several Android source set directories have been renamed (e.g., androidMain to main, androidInstrumentedTest to androidTest, androidUnitTest to test) to reflect updated conventions.
  • Baseline Profile and Keeper Plugin Changes: Configurations for the Baseline Profile and Keeper plugins have been commented out or disabled across various modules, indicating potential temporary removal or incompatibility with the new AGP version.
  • Jacoco Reporting Updates: The Jacoco reporting configuration has been updated to use the new coverageFiles property for collecting test coverage data.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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.

Copy link
Copy Markdown
Contributor

@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 updates the project to use Android Gradle Plugin 9. This is a significant undertaking that touches most of the build scripts. The changes correctly adapt to many new APIs in AGP and the Kotlin Multiplatform plugin, such as the new source set layout and extension configurations.

However, there are a few critical issues and regressions. Several benchmark and generator modules have their dependencies commented out, which will break the build. There's also a regression in the Kotlin compiler configuration, where important settings like allWarningsAsErrors are no longer applied consistently. I've left specific comments with suggestions on how to address these points.

I am having trouble creating individual review comments. Click here to see my feedback.

algorithm-benchmark/build.gradle.kts (50-62)

critical

The dependencies for this module have been commented out instead of being migrated. This will cause the build to fail. Please migrate the dependencies to the new format required by AGP 9.

For example, the KMP sourceSets dependencies should be mapped to the appropriate Gradle configurations (implementation, testImplementation, androidTestImplementation).

This seems to be an issue in other benchmark and generator modules as well, such as app-baseline-profile-generator, app-benchmark, and wear-baseline-profile-generator.

build-logic/convention/src/main/kotlin/com/alexvanyo/composelife/buildlogic/Kotlin.kt (31-45)

high

This block containing common Kotlin compiler settings, including allWarningsAsErrors.set(true), has been removed. While some of these settings were moved to AndroidLibraryConventionPlugin, they are no longer applied to application modules, and allWarningsAsErrors is not applied anywhere.

This is a regression that lowers code quality standards. Please restore this configuration for all Kotlin modules. You might need to adjust how it's applied to work with AGP 9, for example by configuring the kotlin extension in both AndroidApplicationConventionPlugin and AndroidLibraryConventionPlugin.

app/build.gradle.kts (125-129)

medium

The compileOnly dependencies for androidInstrumentedTest (apiGuardian.api and google.autoValue.annotations) have been removed during the migration. If these are still required for instrumentation tests, they should be added back, likely using the androidTestCompileOnly configuration.

build-logic/convention/src/main/kotlin/com/alexvanyo/composelife/buildlogic/Testing.kt (114-121)

medium

This logic, which prevents running instrumentation tests when useSharedTest is configured for Robolectric-only, has been commented out. This is a regression in build validation. While the comment mentions needing a new Gradle API, is there an alternative way to enforce this check with AGP 9? If not, this should be tracked to be fixed later.

@alexvanyo alexvanyo added the dependency Related to dependencies label Mar 31, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.15%. Comparing base (c58b246) to head (df0e1f2).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3259      +/-   ##
============================================
- Coverage     73.09%   69.15%   -3.95%     
============================================
  Files           282      282              
  Lines         14451    14451              
  Branches       2037     2034       -3     
============================================
- Hits          10563     9993     -570     
- Misses         2827     3450     +623     
+ Partials       1061     1008      -53     
Flag Coverage Δ
23 69.05% <ø> (ø)
24 ?
25 ?
26 ?
27 ?
28 ?
29 ?
30 ?
31 ?
32 ?
33 ?
34 ?
35 ?
36 69.06% <ø> (ø)
aosp-nexus4-26 ?
aosp-pixel2-28 ?
aosp-pixel3xl-30 ?
aospatd-pixel2-30 ?
aospatd-pixel2-31 ?
aospatd-pixel6pro-32 ?
aospatd-pixel6pro-33 ?
aospatd-pixel6pro-35 ?
aospatd-pixeltablet-32 ?
aospatd-pixeltablet-33 ?
device ?
googletablet-pixeltablet-35 ?
unit 69.15% <ø> (-0.03%) ⬇️
wear-wearoslargeround-30 ?
wear-wearossquare-30 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependency Related to dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant