Skip to content

Commit

Permalink
fix: add abiFilters to the native template (#546)
Browse files Browse the repository at this point in the history
<!-- Please provide enough information so that others can review your
pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

In the native template `abiFilters` is missing from
`externalNativeBuild` block. This means that the library would be built
for every available ABI when building the application, even if the
application itself is being built for a specific one. This is not that
problematic (besides taking more time) when using React Native aar, but
when building RN from source the core `.so` files will be built for that
specific ABI. In case the library depends on a `.so` file, it would fail
at the linking stage due to missing `.so` for the remaining ABIs.

### Test plan
See
- Expensify/App#40102
- Expensify/react-native-live-markdown#284
- https://github.com/margelo/react-native-quick-sqlite/pull/41

---------

Co-authored-by: Satyajit Sahoo <[email protected]>
  • Loading branch information
j-piasecki and satya164 authored May 16, 2024
1 parent 148fda0 commit c7dfe9e
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ buildscript {
}
}

def reactNativeArchitectures() {
def value = rootProject.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}
Expand Down Expand Up @@ -75,6 +80,7 @@ android {
externalNativeBuild {
cmake {
cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all"
abiFilters (*reactNativeArchitectures())
}
}
<% } -%>
Expand Down

0 comments on commit c7dfe9e

Please sign in to comment.