Skip to content

fix(mobile): pin fbjni to React Native version - #13967

Closed
kvnloo wants to merge 2 commits into
pingdotgg:mainfrom
kvnloo:fix/android-fbjni-version
Closed

kvnloo wants to merge 2 commits into
pingdotgg:mainfrom
kvnloo:fix/android-fbjni-version

Conversation

@kvnloo

@kvnloo kvnloo commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Fresh Android dependency resolution can select fbjni:0.8.1 through react-native-shiki-engine's floating fbjni:+ request. That NDK 28 binary is incompatible with React Native 0.86.3's NDK 27 C++ runtime and can crash before JavaScript starts.

Fix

  • Add an Expo config plugin that forces com.facebook.fbjni:fbjni:0.7.0, matching React Native 0.86.3.
  • Register it beside the existing Android Gradle plugins so clean prebuilds and EAS builds get the same resolution.
  • Add focused coverage for injection, idempotency, and a changed Gradle language.

Fixes #13710.

Verification

The issue has independent device/build confirmation that forcing 0.7.0 restores the expected dependency graph and launch behavior. This branch adds the config-plugin regression test; local execution was not available from this GitHub-only session, so this is opened as a draft for CI verification.

Model: GPT-5.6 Sol. Harness: ChatGPT.

Credit / provenance

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Sep 27, 2026
@andybergon

Copy link
Copy Markdown

Validated this fix from c51940f31e on current main d2c9281b81:

  • Fresh Gradle resolution selects fbjni 0.8.1 without the plugin and 0.7.0 (forced) with it, including shiki's + request.
  • A clean release build passed for all four Android ABIs. Every packaged fbjni/C++ pair matches the official 0.7.0 AAR, and all 42 Shiki C++ imports resolve against the packaged libraries on each ABI.
  • The ARM64 APK passed five cold launches on an Android 16 emulator with an empty crash buffer. Installed as an update with the same package and signer; app data remained intact. The other three ABIs were build/package-tested only.

The plugin tests, targeted lint and formatting pass. One useful addition is a test against React Native's installed version catalog so a future RN upgrade cannot silently leave this pin behind. I verified that this test fails when the force is changed to 0.8.1.

Suggested regression check for the existing test file

Add these imports:

import * as NodeFS from "node:fs";
import * as NodeModule from "node:module";
import * as NodePath from "node:path";

Add this case inside the existing describe:

it("keeps the forced native library aligned with the installed React Native runtime", async () => {
  const require = NodeModule.createRequire(import.meta.url);
  const reactNativeRoot = NodePath.dirname(require.resolve("react-native/package.json"));
  const versions = NodeFS.readFileSync(
    NodePath.join(reactNativeRoot, "gradle/libs.versions.toml"),
    "utf8",
  );
  const reactNativeFbjni = versions.match(/^fbjni\s*=\s*"([^"]+)"/m)?.[1];
  expect(reactNativeFbjni).toBeDefined();

  const generated = await transform(buildGradle);
  const forcedFbjni = generated.match(
    /resolutionStrategy\.force 'com\.facebook\.fbjni:fbjni:([^']+)'/,
  )?.[1];
  expect(forcedFbjni).toBe(reactNativeFbjni);
});

Validation and test addition: GPT-6-Astra through the Codex harness in T3 Code.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 1, 2026 — with ChatGPT Codex Connector

kvnloo commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @andybergon for the thorough Android validation and the concrete regression suggestion. I added the installed React Native version-catalog check to withAndroidFbjniVersion.test.mjs, so a future RN fbjni bump should now fail instead of silently leaving the force stale. I’m not claiming a fresh green run until CI executes the new head; would appreciate a re-review after that.

@maria-rcks

Copy link
Copy Markdown
Collaborator

Note

Written by claude-opus-5-5 on behalf of Maria

Hi! We are cleaning up open PRs, and this one appears to have been created with an older model (gpt-5.6-sol). If this change is really important, we recommend rebuilding the PR with a newer model if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android release builds crash on launch: react-native-shiki-engine resolves fbjni:+ to 0.8.1

4 participants