When enabling React Native’s new architecture(opens in a new tab) with Nutrient React Native SDK 4.x, you may encounter build errors related to codegen headers or Swift bridging. This guide covers the most common issues and their solutions.

Missing Props.h file (iOS)

Error message

'react/renderer/components/nutrient_sdk_react_native_codegen/Props.h' file not found

Cause — Codegen headers weren’t generated during pod install. This happens when the new architecture environment variable isn’t set or when pods need to be reinstalled.

Solution

  1. Ensure your Podfile has the new architecture enabled at the beginning:

    ENV['RCT_NEW_ARCH_ENABLED'] = '1'
  2. Ensure your Podfile includes use_native_modules!:

    use_native_modules!
  3. Reinstall pods to regenerate codegen headers:

    Terminal window
    cd ios
    rm -rf Pods Podfile.lock
    pod install --repo-update
  4. Clean the Xcode build folder and rebuild your project.

Missing codegen header (Android)

Error message

'nutrient_sdk_react_native_codegen/nutrient_sdk_react_native_codegen.h' file not found

Cause — Android CMake cannot find the generated JNI headers. This typically occurs when the new architecture isn’t properly enabled or when the build cache is stale.

Solution

  1. Ensure newArchEnabled=true is set in android/gradle.properties:

    newArchEnabled=true
  2. Clean and rebuild:

    Terminal window
    cd android
    ./gradlew clean
    cd ..
    npx react-native run-android
  3. If the issue persists, delete node_modules and reinstall:

    Terminal window
    rm -rf node_modules
    yarn install
    cd android
    ./gradlew clean
    cd ..
    npx react-native run-android

Missing Swift bridging header (iOS)

Error message

'PSPDFKitReactNativeiOS-Swift.h' file not found

Cause — This issue was fixed in version 2.8.0. If you encounter it, you may be using an older version or have a stale build cache.

Solution

  1. Ensure you’re using @nutrient-sdk/react-native version 2.8.0 or later:

    Terminal window
    yarn upgrade @nutrient-sdk/react-native
  2. Clean your iOS build:

    Terminal window
    cd ios
    rm -rf Pods Podfile.lock
    pod install --repo-update
  3. Clean Xcode derived data:

    Terminal window
    rm -rf ~/Library/Developer/Xcode/DerivedData
  4. Rebuild your project.

General troubleshooting steps

If you’re encountering other build issues with the new architecture, try these steps:

  1. Update to the latest SDK version.

    Terminal window
    yarn upgrade @nutrient-sdk/react-native
  2. Delete your build folders inside your application’s ios and android folders.

    Terminal window
    rm -rf ios/build
    rm -rf android/build
  3. Full clean rebuild.

    Terminal window
    # Remove node_modules
    rm -rf node_modules
    yarn install
    # iOS
    cd ios
    rm -rf Pods Podfile.lock
    pod install --repo-update
    cd ..
    # Android
    cd android
    ./gradlew clean
    cd ..
  4. Verify architecture settings.

    • iOS — Check that ENV['RCT_NEW_ARCH_ENABLED'] = '1' is at the beginning of your Podfile.
    • Android — Check that newArchEnabled=true is in android/gradle.properties.
  5. Check React Native version compatibility. Nutrient React Native SDK 4.x requires React Native 0.77 or later for new architecture support.

For more information about enabling the new architecture, refer to the React Native 4 migration guide.