Course contentsShow
← React Native
Lesson 62 of 1,5551. The React Native ArchitectureFree lesson

Upgrading Native Dependencies

You will be able to resolve native link conflicts during major framework version upgrades.

In this lesson, you will learn how to identify and resolve "native link conflicts" that occur when you upgrade your React Native framework version.

The Challenge of Native Links

When you upgrade React Native, the underlying scaffolding of your Android and iOS projects often changes. If you have third-party native libraries (like react-native-camera or react-native-maps), they are "linked" into your project’s build files—specifically build.gradle on Android and Podfile on iOS.

A native link conflict happens when the new React Native version expects a specific file structure or a specific way of calling native modules, but your old third-party dependency is still trying to use an outdated configuration.

Detecting the Conflict

After running a framework upgrade (e.g., from 0.72 to 0.73), you might see build errors like "Duplicate symbols," "Class not found," or "Header not found." This is your signal that a native dependency is pointing to an old implementation that no longer exists or has been moved by the new architecture.

How to Resolve Them

The most effective way to resolve these is to synchronize your native configurations:

  1. Clean the Slate: Always start by clearing your native build artifacts.

    # For iOS
    cd ios && rm -rf Pods Podfile.lock && pod install
    # For Android
    cd android && ./gradlew clean
    
  2. Verify Compatibility: Check if your dependency has a newer version. If you are on a new React Native version, the library maintainers likely released a fix to support the new CodeGen or TurboModule requirements. Update the library in your package.json.

  3. Manual Patching: If the library isn't updated, you may need to inspect the android/build.gradle or ios/Podfile. If you see hardcoded paths to old React Native headers (like RCTBridge.h), you may need to update them to match the new architecture’s pathing requirements.

Often, simply removing the Pods or node_modules and re-running the installation allows the CodeGen tool to re-generate the necessary bridges, effectively resolving the link conflict automatically.

Key Takeaway: Native link conflicts during upgrades are usually caused by stale configuration files; clearing your build artifacts and ensuring your dependencies support the new architecture will resolve most integration errors.