Skip to content

Issues auto-linking on Android with New Architecture #2666

Open
@daltonwignall

Description

@daltonwignall

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions