Skip to content

fix(android): fix mapbuffer jni headers not found consuming react-native from prefab#48243

Closed
hannojg wants to merge 2 commits into
facebook:mainfrom
hannojg:fix/android-consume-mapbuffer-from-prefab
Closed

fix(android): fix mapbuffer jni headers not found consuming react-native from prefab#48243
hannojg wants to merge 2 commits into
facebook:mainfrom
hannojg:fix/android-consume-mapbuffer-from-prefab

Conversation

@hannojg
Copy link
Copy Markdown
Contributor

@hannojg hannojg commented Dec 12, 2024

Summary:

I was getting build errors when I tried to include StateWrapperImpl.h in my library's code on android. The error was:
CleanShot 2024-12-12 at 15 02 44@2x

node_modules/react-native/ReactAndroid/build/prefab-headers/reactnative/react/fabric/StateWrapperImpl.h:11:10: fatal error: 'react/common/mapbuffer/JReadableMapBuffer.h' file not found
#include <react/common/mapbuffer/JReadableMapBuffer.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 1 error generated.

The problem is that the map buffer files inside the mapbuffer folder are nested, so the prefab outcome looks like this:

CleanShot 2024-12-12 at 14 53 26@2x

Hence it can't resolve the header path.

This change removes the header prefix part as its not needed, since the nested folder structure in mapbuffer already matches what we need, see:

https://github.com/facebook/react-native/tree/main/packages/react-native/ReactAndroid/src/main/jni/react/mapbuffer

Changelog:

[ANDROID] [FIXED] - Fixed build issue when including mapbuffer jni headers in library code

Test Plan:

make sure the header path looks correct in the prefab build dir:

CleanShot 2024-12-12 at 14 41 43@2x

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 12, 2024
@hannojg hannojg marked this pull request as ready for review December 12, 2024 14:10
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 12, 2024
Copy link
Copy Markdown
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this

@hannojg
Copy link
Copy Markdown
Contributor Author

hannojg commented Dec 13, 2024

Sure! Do I need to do something about the failing CI? (the failed CI runs are iOS and this is a android only change so I am confused to why they failed)

@cortinico
Copy link
Copy Markdown
Contributor

Sure! Do I need to do something about the failing CI? (the failed CI runs are iOS and this is a iOS only change so I am confused to why they failed)

cc @cipolleschi

@hannojg
Copy link
Copy Markdown
Contributor Author

hannojg commented Dec 13, 2024

Okay, after a merge with master we are good 👍

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Dec 13, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cortinico merged this pull request in ecf1766.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @hannojg in ecf1766

When will my fix make it into a release? | How to file a pick request?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants