fix(example): guard Kotlin plugin apply for AGP 9 built-in Kotlin - #67
Conversation
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.
|
😎 This pull request was merged. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
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)
🔇 Additional comments (1)
📝 WalkthroughWalkthroughThe Android example now checks for an existing Merge Risk: ⚪ Minimal · up to 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)
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. Comment |
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 guardThe example app applied
org.jetbrains.kotlin.androidunconditionally, so it collides with AGP 9's built-in Kotlin exactly the wayandroid/build.gradledid before #66.The guard is keyed on the
kotlinextension rather than on an AGP version, matching the shape merged in #66.This matters more here than in the library module:
example/android/build.gradledeclaresclasspath("com.android.tools.build:gradle")with no version, so the example's AGP floats with whateverreact-native-gradle-pluginresolves.android/gradle.properties— removed, nothing read itgetExtOrDefaultresolves throughrootProject.extand otherwise falls back to the hardcodedext.StepCountermap inandroid/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.StepCountermap, andStepCounter_ndkVersionset a value the library build never applies.Deliberately not changed
android/build.gradle'sclasspath "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
.gradlefiles and groovy is not installed locally, so there was no local syntax gate.Native Android Example Buildis the check that actually compiles this.StepCounter_*properties so configuration uses the existingrootProject.extandext.StepCountersources.Native Android Example Buildcheck because local Gradle syntax validation is unavailable.