Skip to content

AAR packaging support for pure C++ TurboModules #123

@arcticfox1919

Description

@arcticfox1919

Description:

Hi there! 👋

I've encountered an issue with AAR packaging when it comes to pure C++ TurboModules, and I'm hoping to get some guidance or see if this is a known limitation.

Environment

  • React Native version: 0.76.5
  • Platform: Android
  • Build type: AAR packaging

Problem Description

The AAR packaging script appears to not support pure C++ TurboModules properly. When I include dependencies like react-native-fs-turbo, the generated AAR package doesn't contain the native dynamic libraries (.so files) that these modules produce.

Steps to Reproduce

  1. Add a pure C++ TurboModule dependency (e.g., react-native-fs-turbo) to a React Native project
  2. Build the project into an AAR package using the current packaging script
  3. Integrate the AAR into an Android app project
  4. Run the application

Expected Behavior

The AAR should include all necessary native libraries from pure C++ TurboModules, allowing the consuming app to function correctly.

Actual Behavior

The AAR is missing the native dynamic libraries from pure C++ TurboModules. When the consuming app tries to use these modules, it throws:

Exception in native call from JS
com.facebook.react.common.JavascriptException: EarlyJsError: TurboModuleRegistry.getEnforcing(...): 'PlatformConstants' could not be found. Verify that a module by this name is registered in the native binary., stack:
          invariant@2126:26
          getEnforcing@2818:28
          anonymous@2786:68
          loadModuleImplementation@267:14
          guardedLoadModule@175:38
          metroRequire@89:92
          anonymous@2764:76
          loadModuleImplementation@267:14
          guardedLoadModule@175:38
          metroRequire@89:92
          anonymous@2723:75
Image

Additional Context

I've tested this with multiple pure C++ TurboModules and consistently get the same result. It seems like the packaging process might not be properly detecting or including the native artifacts generated by these modules.

Would it be possible to enhance the AAR packaging to better support pure C++ TurboModules? Or if there's a workaround I should be aware of, I'd greatly appreciate any guidance!

Thanks for your time and for all the great work on this project! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions