Skip to content

Issues auto-linking on Android with New Architecture #2666

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

Open
daltonwignall opened this issue May 28, 2025 · 0 comments
Open

Issues auto-linking on Android with New Architecture #2666

daltonwignall opened this issue May 28, 2025 · 0 comments
Labels
question Further information is requested

Comments

@daltonwignall
Copy link

daltonwignall commented May 28, 2025

Ask your Question

Hello,

We are unfortunately running into some challenging issues auto-linking native modules on the new architecture and React Native 0.79.2.

We have completed the necessary setup for auto-linking and have verified that it works when using old architecture (i.e. newArchEnabled=false), but have not been able to get the auto-linking working with new architecture on Android. We have it working on iOS though.

The initial error we were getting was an app:buildCMakeDebug error followed by CPP errors like:

ld.lld: error: undefined symbol: facebook::react::Sealable::ensureUnsealed() const
>>> referenced by RNCSafeAreaViewShadowNode.cpp:40

After deeper digging I noticed in the documentation that there are some modules that have their own internal auto-linking setup and should be treated differently. What is still unclear to me though is if this section is for people on the new architecture that need to treat the aforementioned modules differently or if it's for people on the old architecture that need to ignore the new means of auto-linking for the new architecture?

Regardless, I gave this a try by creating a react-native.config.js with the following contents:

module.exports = {
  dependencies: {
    'react-native-safe-area-context': {
      platforms: {
        android: {
          libraryName: null,
          componentDescriptors: null,
          cmakeListsPath: null,
          cxxModuleCMakeListsModuleName: null,
          cxxModuleCMakeListsPath: null,
          cxxModuleHeaderName: null,
        },
      },
    },
    'react-native-screens': {
      platforms: {
        android: {
          libraryName: null,
          componentDescriptors: null,
          cmakeListsPath: null,
          cxxModuleCMakeListsModuleName: null,
          cxxModuleCMakeListsPath: null,
          cxxModuleHeaderName: null,
        },
      },
    },
    'react-native-svg': {
      platforms: {
        android: {
          libraryName: null,
          componentDescriptors: null,
          cmakeListsPath: null,
          cxxModuleCMakeListsModuleName: null,
          cxxModuleCMakeListsPath: null,
          cxxModuleHeaderName: null,
        },
      },
    },
    'react-native-reanimated': {
      platforms: {
        android: {
          libraryName: null,
          componentDescriptors: null,
          cmakeListsPath: null,
          cxxModuleCMakeListsModuleName: null,
          cxxModuleCMakeListsPath: null,
          cxxModuleHeaderName: null,
        },
      },
    },
    'react-native-webview': {
      platforms: {
        android: {
          libraryName: null,
          componentDescriptors: null,
          cmakeListsPath: null,
          cxxModuleCMakeListsModuleName: null,
          cxxModuleCMakeListsPath: null,
          cxxModuleHeaderName: null,
        },
      },
    },
  },
};

But then I received the following error where it appears that the CLI doesn't seem to think cxxModuleCMakeListsModuleName is a valid property even though it's definitely referenced in the documentation and internal source code.

error Failed to load configuration of your project.
Config Validation Error: "dependencies.react-native-safe-area-context.platforms.android.cxxModuleCMakeListsModuleName" is not allowed
    at parseUserConfig (/Users/dalton.wignall/repos/Android-Project/node_modules/@react-native-community/cli-config/build/readConfigFromDisk.js:48:11)
    at readConfigFromDiskAsync (/Users/dalton.wignall/repos/Android-Project/node_modules/@react-native-community/cli-config/build/readConfigFromDisk.js:63:10)
    at async loadConfigAsync (/Users/dalton.wignall/repos/Android-Project/node_modules/@react-native-community/cli-config/build/loadConfig.js:141:22)
    at async setupAndRun (/Users/dalton.wignall/repos/Android-Project/node_modules/@react-native-community/cli/build/index.js:204:14)
    at async Object.run (/Users/dalton.wignall/repos/Android-Project/node_modules/@react-native-community/cli/build/index.js:159:5)

FWIW I also gave something like the following a try:

    'react-native-safe-area-context': {
      platforms: {
        android: null
      },
    },

Which from my understanding ignores the auto-linking for the modules, and then the app builds. BUT it doesn't appear that any of the native modules get linked and included at that point so I hit runtime errors.

Is there something we are missing here? Or is this possibly part of a larger issue with the linking process on new architecture? Any insight would be greatly appreciated!

@daltonwignall daltonwignall added the question Further information is requested label May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant