Skip to content

fix(example): guard Kotlin plugin apply for AGP 9 built-in Kotlin - #67

Merged
AndrewDongminYoo merged 2 commits into
mainfrom
fix/agp9-example-app-kotlin-guard
Sep 5, 2026
Merged

AndrewDongminYoo merged 2 commits into
mainfrom
fix/agp9-example-app-kotlin-guard

Conversation

@AndrewDongminYoo

@AndrewDongminYoo AndrewDongminYoo commented Sep 5, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #66, which fixed the library module.
This applies the same treatment to the two places the review of that PR surfaced but left out of scope.

example/android/app/build.gradle — same AGP 9 guard

The example app applied org.jetbrains.kotlin.android unconditionally, so it collides with AGP 9's built-in Kotlin exactly the way android/build.gradle did before #66.
The guard is keyed on the kotlin extension rather than on an AGP version, matching the shape merged in #66.

This matters more here than in the library module: example/android/build.gradle declares classpath("com.android.tools.build:gradle") with no version, so the example's AGP floats with whatever react-native-gradle-plugin resolves.

android/gradle.properties — removed, nothing read it

getExtOrDefault resolves through rootProject.ext and otherwise falls back to the hardcoded ext.StepCounter map in android/build.gradle.
It never consults a StepCounter_-prefixed project property, which is the create-react-native-library convention this file was written for.

A repo-wide grep finds the five keys only in that file.
Four of them duplicated numbers already present in the ext.StepCounter map, and StepCounter_ndkVersion set a value the library build never applies.

Deliberately not changed

android/build.gradle's classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:..." stays.
It reads as dead weight on the AGP 9 path, but on AGP 8.x the guard passes and apply plugin: "kotlin-android" resolves off exactly that classpath entry, so removing it would break the only path this repository currently builds.

Verification

No trunk linter covers .gradle files and groovy is not installed locally, so there was no local syntax gate.
Native Android Example Build is the check that actually compiles this.

  • Updated the example Android app for AGP 9 compatibility by preventing duplicate Kotlin plugin configuration.
  • Removed unused StepCounter_* properties so configuration uses the existing rootProject.ext and ext.StepCounter sources.
  • Preserved the Kotlin Gradle plugin classpath to maintain AGP 8.x compatibility.
  • Verification relies on the Native Android Example Build check because local Gradle syntax validation is unavailable.

AGP 9 registers the `kotlin` extension itself, so the unconditional apply in the example app fails configuration the same way the library module did before #66.
Wrap it in the same guard, keyed on the extension rather than on an AGP version.

The example resolves AGP transitively through react-native-gradle-plugin with no pinned version, so this applies as soon as that resolution moves to AGP 9.
Nothing reads these. `getExtOrDefault` resolves through `rootProject.ext` and otherwise falls back to the hardcoded `ext.StepCounter` map, never to a `StepCounter_`-prefixed project property.
The file only duplicated the four numbers already in that map, plus an ndkVersion the library build never applies.
@trunk-io

trunk-io Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-05T14:08:56.381956Z 5a6ffa4 PR opened
🔒 Security Review ✅ Completed 2026-09-05T14:09:07.956593Z 5a6ffa4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 89678913-4845-40e0-b771-6107a2bf2156

📥 Commits

Reviewing files that changed from the base of the PR and between b74e9c8 and 5a6ffa4.

📒 Files selected for processing (2)
  • android/gradle.properties
  • example/android/app/build.gradle
💤 Files with no reviewable changes (1)
  • android/gradle.properties

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: build-android
  • GitHub Check: build-ios
🔇 Additional comments (1)
example/android/app/build.gradle (1)

2-8: LGTM!


📝 Walkthrough

Walkthrough

The Android example now checks for an existing kotlin extension before applying org.jetbrains.kotlin.android. This prevents duplicate Kotlin extension configuration when AGP 9 provides Kotlin support. The plugin remains applied when no Kotlin extension exists. Five obsolete StepCounter_* properties were removed from android/gradle.properties.

Merge Risk: ⚪ Minimal · up to 5a6ff

The Android example now avoids duplicate Kotlin configuration under AGP 9 while retaining Kotlin plugin setup for older environments. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: guarding Kotlin plugin application for AGP 9 compatibility in the example app.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.

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.

@AndrewDongminYoo AndrewDongminYoo self-assigned this Sep 5, 2026
@AndrewDongminYoo
AndrewDongminYoo merged commit 3a63397 into main Sep 5, 2026
5 checks passed
@AndrewDongminYoo
AndrewDongminYoo deleted the fix/agp9-example-app-kotlin-guard branch September 5, 2026 16:25
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