Skip to content

fix: Support Android Gradle Plugin 9.x#420

Merged
ABausG merged 2 commits into
ABausG:mainfrom
giaquo:agp9-compatibility
May 23, 2026
Merged

fix: Support Android Gradle Plugin 9.x#420
ABausG merged 2 commits into
ABausG:mainfrom
giaquo:agp9-compatibility

Conversation

@giaquo
Copy link
Copy Markdown
Contributor

@giaquo giaquo commented May 22, 2026

Description

Starting with Android Gradle Plugin 9.0, Kotlin support is embedded in
AGP itself and applying the standalone kotlin-android plugin causes a
build failure.

This PR detects the AGP version and skips both the plugin application
and the kotlinOptions block when running on AGP 9 or above, keeping
the existing behavior unchanged for AGP 8.x and below.

Same approach used by file_picker
since version 10.x.

Checklist

  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation and added code (documentation) comments where necessary.
  • I have updated/added relevant examples in example or documentation.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

@docs-page
Copy link
Copy Markdown

docs-page Bot commented May 22, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/abausg/home_widget~420

Documentation is deployed and generated using docs.page.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Review Change Stack

Walkthrough

Detects Android Gradle Plugin >= 9 via com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION and applies kotlin-android plus kotlinOptions { jvmTarget = "1.8" } only when AGP is below 9.

Changes

Android Gradle Plugin Version Compatibility

Layer / File(s) Summary
AGP version detection and conditional Kotlin configuration
packages/home_widget/android/build.gradle
Adds isAgp9OrAbove from com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION and makes applying kotlin-android and the kotlinOptions { jvmTarget = "1.8" } block conditional on AGP being below 9 (previously unconditional).

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: adding support for Android Gradle Plugin 9.x by addressing the kotlin-android plugin compatibility issue.
Description check ✅ Passed The pull request description covers the main issue, solution approach, and references similar implementations. The description template structure is followed with completed sections for description, checklist acknowledgment, and breaking change declaration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@giaquo giaquo changed the title fix: support AGP 9.x by skipping kotlin-android plugin when embedded fix: Support AGP 9.x by skipping kotlin-android plugin when embedded May 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e42f1f7) to head (737b49c).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #420   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          175       175           
=========================================
  Hits           175       175           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ABausG ABausG changed the title fix: Support AGP 9.x by skipping kotlin-android plugin when embedded fix: Support Android Gradle Plugin 9.x May 23, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/home_widget/android/build.gradle (1)

60-62: 💤 Low value

Consider separating dependency updates from the AGP 9 compatibility fix.

These dependency updates (glance-appwidget, work-runtime-ktx, kotlinx-coroutines-android) are not mentioned in the PR description or title. If they're required for AGP 9 compatibility, please document that relationship. Otherwise, consider moving them to a separate PR for clearer change tracking and easier rollback if needed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/home_widget/android/build.gradle` around lines 60 - 62, The PR
currently mixes AGP 9 compatibility changes with dependency bumps for
androidx.glance:glance-appwidget:1.1.1, androidx.work:work-runtime-ktx:2.11.2,
and org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2; either move these
three dependency upgrades into a separate PR (restore previous versions here) or
add a short note in the PR description explaining why each bump is required for
AGP 9 compatibility and which tests/changes justify them so reviewers can track
and revert individually if needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/home_widget/android/build.gradle`:
- Around line 60-62: The PR currently mixes AGP 9 compatibility changes with
dependency bumps for androidx.glance:glance-appwidget:1.1.1,
androidx.work:work-runtime-ktx:2.11.2, and
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2; either move these three
dependency upgrades into a separate PR (restore previous versions here) or add a
short note in the PR description explaining why each bump is required for AGP 9
compatibility and which tests/changes justify them so reviewers can track and
revert individually if needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1e08c07c-4074-466a-91ae-2bb31d638b3f

📥 Commits

Reviewing files that changed from the base of the PR and between 085fdc3 and 737b49c.

📒 Files selected for processing (1)
  • packages/home_widget/android/build.gradle

@ABausG ABausG merged commit cb2b4ad into ABausG:main May 23, 2026
14 checks passed
@westy92 westy92 mentioned this pull request May 23, 2026
1 task
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.

2 participants