-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix linking error after Gradle clean project on Android #7866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tomekzaw
merged 9 commits into
main
from
@tomekzaw/fix-linking-error-after-gradle-clean
Jul 28, 2025
Merged
Fix linking error after Gradle clean project on Android #7866
tomekzaw
merged 9 commits into
main
from
@tomekzaw/fix-linking-error-after-gradle-clean
Jul 28, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tjzel
approved these changes
Jul 23, 2025
This was referenced Jul 24, 2025
tjzel
approved these changes
Jul 25, 2025
piaskowyk
approved these changes
Jul 28, 2025
MatiPl01
pushed a commit
that referenced
this pull request
Jul 28, 2025
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary This PR fixes the following linking error `on Android due to undefined symbols when trying to build fabric-example via Android Studio after running Clean project after the app was built successfully. <img alt="" src="https://github.com/user-attachments/assets/a96dfc25-b039-4e0b-8a2f-0a88ef4703c2" /> ``` ld.lld: error: undefined symbol: worklets::stringifyJSIValue(facebook::jsi::Runtime&, facebook::jsi::Value const&) ``` Previously, we would include `react-native-worklets::worklets` prefab but still build `libworklets.so` from source. Because of the way how Android Gradle Plugin works (ask @lukmccall for more details), `libworklets` would sometimes be treated like a header-only library with no shared object files, causing the aforementioned linking error. The proposed solution is to abandon prefabs in favor of linking `libworklets.so` manually (using `add_library`) as well as passing additional header search paths (using `target_include_directories`). ## Test plan <!-- Provide a minimal but complete code snippet that can be used to test out this change along with instructions how to run it and a description of the expected behavior. -->
MatiPl01
added a commit
that referenced
this pull request
Jul 28, 2025
…#7919) Cherry-pick of the #7866 PR Co-authored-by: Tomasz Zawadzki <[email protected]>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 2, 2025
## Summary Follow-up to - #7866 I accidentally found code from the following PR - mrousavy/nitro#776 which fixes our prefab issues when running `Project Clean` then `Build` in Android Studio. ## Test plan 1. Clean your repo with `git clean -Xdf` 2. Install deps with `yarn` 3. Open `apps/fabric-example/android` with AndroidStudio 4. Run build 5. Run clean 6. Run build (without this change here Reanimated would complain about missing symbols) 7. 🥳
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the following linking error `on Android due to undefined symbols when trying to build fabric-example via Android Studio after running Clean project after the app was built successfully.
Previously, we would include
react-native-worklets::workletsprefab but still buildlibworklets.sofrom source. Because of the way how Android Gradle Plugin works (ask @lukmccall for more details),libworkletswould sometimes be treated like a header-only library with no shared object files, causing the aforementioned linking error.The proposed solution is to abandon prefabs in favor of linking
libworklets.somanually (usingadd_library) as well as passing additional header search paths (usingtarget_include_directories).Test plan