Skip to content

fix(bgp): pick the right .so files for the AAR - #520

Merged
hurali97 merged 1 commit into
callstack:mainfrom
KisaneNeko:fix/bgp-aar-so-files
Nov 9, 2026
Merged

hurali97 merged 1 commit into
callstack:mainfrom
KisaneNeko:fix/bgp-aar-so-files

Conversation

@KisaneNeko

@KisaneNeko KisaneNeko commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The plugin picked the wrong .so files for the AAR, and the host app failed in both modes:

  • With useStrippedSoFiles = false, the AAR had no libappmodules.so or libreact_codegen_*.so, so the host crashed at runtime. It also embedded libc++_shared.so, libreactnative.so and other React Native libs, so the host build failed on duplicates.
  • With useStrippedSoFiles = true, it embedded the .so files of every Maven dependency. The host gets those from the POM as well, so its build failed with 2 files found with path 'lib/<abi>/<name>.so' whenever the two versions differ.

Both are regressions from v1, which always embedded the app module's libs and, in stripped mode, only the libs the embedded libraries ship:

Change

  • JNILibsProcessor.kt: both modes now use one rule. The AAR gets the app module's own libs plus the libs of embedded libraries, minus the ignore list. Libs that only come from Maven dependencies stay out, because the host resolves them through the POM. The flag now only picks the stripped or unstripped source.
  • Only the ABIs the app module built are used, so an abiFilters setup can't produce an ABI folder without libappmodules.so.
  • The task now depends on the explode task. Before, it could run before the embedded AARs were unpacked.
  • reactBrownfield.dynamicLibs is back, for a .so the host can't get any other way (built or shipped by the app module, or a local file dependency).
  • The libs left out, and the reason for each, are written to <module>/build/reports/brownfield/<variant>/skipped-so.txt. The build prints a one-line summary.
  • There are warnings for dynamicLibs entries that match nothing or that an ignore entry drops.
  • README "Dynamic libs" section and a minor changeset.

Verified on main and on this branch with ExpoApp57 and RNApp, consumed by AndroidApp:

  • main fails in both modes (the duplicate error was reproduced with a different animated-gif version in the host).
  • This branch builds in both modes.
  • The unstripped Expo screen renders on an API 34 emulator.
  • RNApp's AAR has the same .so set as on main.

Before merging

A brownfield app with more native modules than our demo apps should build against a snapshot of this branch, and its skipped-so.txt should list only libs from Maven dependencies the host declares. A lib missing there would crash at runtime, and the demo apps can't show that.

Embed the app module's own libs and the libs of embedded libraries in
both useStrippedSoFiles modes, and leave out libs that only come from
Maven dependencies. Restore dynamicLibs, follow the app module's ABIs,
and write the left-out libs to build/reports/brownfield/<variant>/skipped-so.txt.
@KisaneNeko
KisaneNeko marked this pull request as draft November 5, 2026 13:43
@KisaneNeko
KisaneNeko marked this pull request as ready for review November 5, 2026 14:01

@andrei-zgirvaci andrei-zgirvaci 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! This fixes our blocker. Thank you!

@hurali97
hurali97 merged commit b87cdff into callstack:main Nov 9, 2026
13 checks passed
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