Skip to content

fix(android): remove adbOptions block that breaks builds on AGP 9 - #430

Merged
thomson-t merged 1 commit into
mainfrom
thomson-t/agp-9-compatibility-fix
Oct 2, 2026
Merged

thomson-t merged 1 commit into
mainfrom
thomson-t/agp-9-compatibility-fix

Conversation

@thomson-t

Copy link
Copy Markdown
Contributor

Why

Android builds fail for apps on React Native 0.87, or on any other setup with AGP 9, that use this package. Gradle stops while it configures :react-native-mparticle:

Could not find method installOptions() for arguments [-d, -t] on object of type com.android.build.gradle.internal.dsl.LibraryInstallationImpl$AgpDecorated.

React Native 0.87 moved to Android Gradle Plugin (AGP) 9.2.1 and Gradle 9.4.1. AGP 9.0 removed the installOptions(String...) method that android/build.gradle calls. Every released version of this package has that call, including 3.4.0. CI did not catch it because the sample app is on React Native 0.84 (AGP 8.12) and the module's own build uses AGP 8.1.4. Once this lands, apps on React Native 0.87 build again.

Programme

Standalone fix, no programme. It comes from a report of this build failure.

What changes

This deletes the adbOptions { timeOutInMs …; installOptions "-d","-t" } block from android/build.gradle. The block dates from the first Android commit in 2017. It set adb flags (allow version downgrade, allow test-only APKs, 10-minute timeout) that apply only when Gradle installs this module's own instrumented-test APK. The module has no androidTest sources and CI runs no connectedAndroidTest, so nothing used the block, and app builds never did.

There is no replacement and no documentation change. The release-draft workflow generates the changelog.

Linked work

None.

Rollout

Path: merging publishes nothing. The fix reaches apps in the next 3.x release of this package, which the release-draft workflow prepares. It takes effect when an app upgrades and rebuilds.
Feature flags: none.
Turning it off: a published version cannot be recalled. Reverting this pull request and releasing again restores the block in the next version.
What we watch: this repository's issues for Android build failures on React Native 0.87 or newer. There is no production dashboard for a client library.

Risks

  • Apps on AGP 8 could lose an install setting. This should not happen: the block only affected installing this module's own test APK, which app builds never do. If it did happen, we would see a change in how installDebug behaves for apps. CI's AGP 8 jobs (Android unit tests, lint, ktlint, sample app) still build the module.
  • React Native 0.87 apps could fail later in the build, at a step after the removed line. Building a fresh React Native 0.87.1 app with this change all the way to an APK rules this out. If it did happen, we would see a different configuration or compile error from :react-native-mparticle.
  • Apps on AGP 9 that remove React Native's android.builtInKotlin=false and android.newDsl=false opt-outs still fail, because this module applies kotlin-android. This PR does not address that: React Native's own template app fails the same way without those opt-outs. AGP 10 will remove the opt-outs, so a follow-up is needed (see the notes).

Risk class: low.

Who

Written by: an automated coding agent (Claude Code), at an engineer's request.
Code reviewed before opening: an independent review agent reviewed the change before it was committed and passed it.
Design reviewed before opening: the requesting engineer approved deleting the block, and limiting scope to React Native 0.87's default Gradle settings.
Decision this implements: the requesting engineer's approval on 2026-10-02. The record is internal and cannot be linked.
Checked: on 2026-10-02 I built a fresh React Native 0.87.1 app (AGP 9.2.1, Gradle 9.4.1, Kotlin 2.2.0, template gradle.properties) with this package installed from a yarn dev:pack tarball, using ./gradlew :app:assembleDebug -PreactNativeArchitectures=arm64-v8a.

  • Against main, the build fails with the error above.
  • With this change, it passes: an APK is produced and :react-native-mparticle:compileDebugKotlin runs.
  • cd android && ./gradlew test lint ktlintCheck (AGP 8.1.4) passes locally.

Not checked:

  • Running the app on an emulator or device.
  • A release build.
  • React Native 0.76 to 0.83. CI's sample app covers 0.84 on AGP 8.12.

Size

Hand-written: 0 lines added and 4 removed, in 1 file.
Generated: none.

Notes for reviewers

AGP 9 opt-outs. React Native 0.87's template sets android.builtInKotlin=false and android.newDsl=false. With those set, apply plugin: 'kotlin-android' and kotlinOptions still work, which is why the build first failed at the installOptions line.

Removing the opt-outs breaks the build in two places:

  • React Native's own template app fails first, with Failed to apply plugin 'org.jetbrains.kotlin.android'.
  • If the app's own plugin is also removed, this module fails at apply plugin: 'kotlin-android' with Cannot add extension with name 'kotlin'.

Supporting built-in Kotlin needs a separate change that keeps AGP 8 working. It would drop kotlin-android on AGP 9 and move kotlinOptions to kotlin.compilerOptions.

Gradle 10 warning from this module. --warning-mode all reports the Groovy propName value assignment syntax, which Gradle 10 removes. The first hit is namespace 'com.mparticle.react'. React Native's template app/build.gradle gets the same warning.

🤖 Generated with Claude Code

AGP 9.0 removed Installation.installOptions(String...), so apps on
React Native 0.87+ (AGP 9.2.1) fail to configure this module with
"Could not find method installOptions()". The block only set adb flags
for installing this module's own instrumented tests, which do not exist.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@thomson-t
thomson-t marked this pull request as ready for review October 2, 2026 13:53
Copilot AI balanced review requested due to automatic review settings October 2, 2026 13:53
@thomson-t
thomson-t requested a review from a team as a code owner October 2, 2026 13:53
@cursor

cursor Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Removes an unused legacy Gradle configuration block that caused build failures on newer AGP versions.

Overview
Removes the obsolete adbOptions configuration block from android/build.gradle.

This resolves Android build failures on Android Gradle Plugin (AGP) 9 (used in React Native 0.87+), where the installOptions DSL method was removed.

Reviewed by Cursor Bugbot for commit 03ccbc1. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused removal resolves the AGP 9 configuration failure without affecting production builds.

Review effort: Balanced
Findings: None

What changed in this PR

Removes obsolete Android installation options that prevent builds with AGP 9.

Changes:

  • Deletes the unused adbOptions block.
  • Restores compatibility with React Native 0.87 and AGP 9.
File Description
android/​build.gradle Removes unsupported test APK installation settings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@thomson-t
thomson-t merged commit 85567f7 into main Oct 2, 2026
12 checks passed
@thomson-t
thomson-t deleted the thomson-t/agp-9-compatibility-fix branch October 2, 2026 14:43
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.

3 participants