Skip to content

Fix(dynamic_color): apply Kotlin plugin conditionally for AGP 8.x compatibility - #697

Open
HoshsL wants to merge 3 commits into
material-foundation:mainfrom
HoshsL:fix/dynamic-color-agp8-kotlin-plugin
Open

Fix(dynamic_color): apply Kotlin plugin conditionally for AGP 8.x compatibility#697
HoshsL wants to merge 3 commits into
material-foundation:mainfrom
HoshsL:fix/dynamic-color-agp8-kotlin-plugin

Conversation

@HoshsL

@HoshsL HoshsL commented Aug 12, 2026

Copy link
Copy Markdown

Description

This change adds an AGP version check so that apply(plugin = "org.jetbrains.kotlin.android") is only executed on AGP 8.x and below, where it is required. AGP 9.x and above handle Kotlin plugin application automatically and no longer need this explicit apply.

Tests

No Dart code was modified. Build compatibility has been verified against both AGP 8.x and 9.x.

Issues

Fixes #695

Checklist

@HoshsL
HoshsL requested a review from a team as a code owner August 12, 2026 09:59

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Thanks a lot for your contribution! I'm new to this package. Is this urgent to merge? if so, feel free to land it after addressing the comments below. Otherwise, we can wait for @guidezpl's for a second review:)

Comment thread packages/dynamic_color/CHANGELOG.md Outdated
kotlin {
val agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.substringBefore('.').toInt()

if (agpMajor < 9) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we add a short comment explaining why this conditional exists?

Co-authored-by: Qun Cheng <36861262+QuncCccccc@users.noreply.github.com>

@guidezpl guidezpl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR! Happy to approve this as a patch, could you bump the version to 1.9.1 and update the changelog accordingly?

@HoshsL

HoshsL commented Aug 13, 2026

Copy link
Copy Markdown
Author

@guidezpl Thanks for the review! I've bumped the version to 1.9.1 and updated the changelog as requested.
On a side note, I noticed that the 1.9.0 release date in CHANGELOG.md is listed as 2025-08-07, but based on the commit history it should be 2026-08-07. Would you like me to fix that in this PR, or would you prefer a separate one? Happy to do whichever is easier for you.

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.

android/build.gradle.kts fails to compile: kotlin {} DSL block unresolved (missing Kotlin plugin apply)

3 participants