7 duplicate symbols for architecture x86_64 in react native

Viewed 7651

when I am trying to run my react native app on the ios simulator I am getting this error.

Error:

duplicate symbol '_EXCanAskAgain' in:
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/EXPermissions/libEXPermissions.a(EXPermissions.o)
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/UMReactNativeAdapter/UMReactNativeAdapter.framework/UMReactNativeAdapter(EXPermissionsService.o)
duplicate symbol '_EXExpiresKey' in:
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/EXPermissions/libEXPermissions.a(EXPermissions.o)
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/UMReactNativeAdapter/UMReactNativeAdapter.framework/UMReactNativeAdapter(EXPermissionsService.o)
duplicate symbol '_EXGrantedKey' in:
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/EXPermissions/libEXPermissions.a(EXPermissions.o)
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/UMReactNativeAdapter/UMReactNativeAdapter.framework/UMReactNativeAdapter(EXPermissionsService.o)
duplicate symbol '_EXPermissionExpiresNever' in:
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/EXPermissions/libEXPermissions.a(EXPermissions.o)
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/UMReactNativeAdapter/UMReactNativeAdapter.framework/UMReactNativeAdapter(EXPermissionsService.o)
duplicate symbol '_EXStatusKey' in:
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/EXPermissions/libEXPermissions.a(EXPermissions.o)
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/UMReactNativeAdapter/UMReactNativeAdapter.framework/UMReactNativeAdapter(EXPermissionsService.o)
duplicate symbol '_OBJC_CLASS_$_EXReactNativeUserNotificationCenterProxy' in:
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/EXPermissions/libEXPermissions.a(EXReactNativeUserNotificationCenterProxy.o)
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/UMReactNativeAdapter/UMReactNativeAdapter.framework/UMReactNativeAdapter(EXReactNativeUserNotificationCenterProxy.o)
duplicate symbol '_OBJC_METACLASS_$_EXReactNativeUserNotificationCenterProxy' in:
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/EXPermissions/libEXPermissions.a(EXReactNativeUserNotificationCenterProxy.o)
    /Users/harshmishra/Library/Developer/Xcode/DerivedData/myways-gkjarpvjrufpitdstvqcnasxhmrs/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/UMReactNativeAdapter/UMReactNativeAdapter.framework/UMReactNativeAdapter(EXReactNativeUserNotificationCenterProxy.o)
ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have tried cleaning the build folder, running pod install again but nothing works out. I am stuck on this error. I am not able to find what's causing this error. Also, I have checked myApp > Libraries folder there is nothing(empty folder).

4 Answers

I had exactly the same error after adding react-native-unimodules library to the app I am working on.

After several hours of trying different solutions we were able to fix the error by downgrading the react-native-unimodules library from the current 0.14.7 version to 0.13.3.

  • changed the react-native-unimodules version in package.json
  • reinstalled the packages (yarn install for me)
  • cd ios, then pod deintegrate (just to be sure), then pod install
  • in XCode went to Product tab and Clean Build Folder from there
  • launched the app and it compiled successfully

Hope it helps anyone else who encounters the issue.

SOLVED @Jan 20 2022

react-native-unimodules is the main culprit. since expo has updated itself and react-native-unimodules are now deprecated.

yarn remove react-native-unimodules

OR

npm uninstall react-native-unimodules

In pod file

# require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
# use_unimodules!

also clean your AppDelegate.m and AppDelegate.h

delete node_modules

    pod install

make build and good to go. expo-packages won't work. now delete expo packages that you are currently using from your package.json again yarn install then in iOS directory pod install and make build all good. still expo packages are not working, now search whatever expo-package you want to use and then follow the documentation. Thanks me later.

The expo-permissions in the react-native-unimodules library 0.14.7 is outdated which caused the 7 duplicate symbols for architecture x86_64 in react native issue when you build the app. To fix this issue, you need to

  • run npm install expo-permissions
  • run pod install in ios folder
  • build and run iOS app again

Try to upgrade expo-permissions to latest version

Related