Skip to content

android-jsi CMake builds for all NDK ABIs regardless of reactNativeArchitectures filter #1971

@SscSPs

Description

@SscSPs

Description

When a React Native project passes -PreactNativeArchitectures to restrict which ABIs to build for (e.g. arm64-v8a,armeabi-v7a), the app module respects the filter — but the watermelondb-android-jsi native library compiles for all NDK ABIs (including x86, x86_64) anyway.

This wastes significant CPU time during local and EAS builds, especially on developer machines or CI runners where every second counts. The unnecessary .so files are eventually stripped from the AAB packaging, so it is purely wasted work.

Root Cause

The native/android-jsi/build.gradle has no abiFilters in its defaultConfig.ndk{} block, so CMake/ninja builds for every architecture the NDK supports — ignoring the parent project's reactNativeArchitectures property.

Proposed Fix

PR #1970 adds an ndk.abiFilters block in defaultConfig that reads the reactNativeArchitectures (or react.nativeArchitectures) property from rootProject. When unset, the list is empty which is a no-op (all ABIs built, same as before).

Steps to Reproduce

  1. Set android.gradleCommand in eas.json to :app:bundleRelease -PreactNativeArchitectures=arm64-v8a
  2. Run eas build --platform android --profile production --local
  3. Observe that ninja spawns x86 and x86_64 build processes for watermelondb-android-jsi

Environment

  • WatermelonDB: current master
  • React Native: 0.85.x
  • Android: API 26+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions