11

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).

Harsh Mishra
  • 862
  • 3
  • 15
  • 29

4 Answers4

11

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.

  • 2
    Yeah, it worked, but there should be some better way than downgrading lib, tho? – jonzee Sep 19 '21 at 17:06
  • 1
    I can confirm that Robert Loh's solution worked - the build error was gone after upgrading react-native-unimodules to the current version and also adding expo-permissions – Dimitri Petrov Oct 01 '21 at 13:59
  • is it still working for you ? @DmitryPetrov – AlexUA Oct 23 '21 at 07:14
  • yes it does - I added expo-permissions and bumped react-native-unimodules to 0.14.7, works fine for me. what issue do you have? – Dimitri Petrov Oct 24 '21 at 02:56
  • https://stackoverflow.com/questions/69705826/react-native-0-66-1-unable-to-build-neither-android-nor-ios-bundle this is what i have for now – AlexUA Oct 25 '21 at 09:46
  • I'm using the managed workflow, don't have unimodules or expo-permissions directly installed, and have a similar error. – Phobos Nov 04 '21 at 05:20
  • Thanks, @DmitryPetrov it worked perfectly. – imrealashu Dec 20 '21 at 20:13
5

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.

Soban Arshad
  • 1,295
  • 19
  • 15
  • How to clean this AppDelegate.m and AppDelegate.h? – Potamir Apr 18 '22 at 09:48
  • 1
    do run above written commands, and then run project, Xcode will through errors, just comment all the lines having error. – Soban Arshad Apr 18 '22 at 14:39
  • I can't comment some codes because it affected other codes. can you help me please to check this repo https://github.com/potamir/issues-unimodules-ios/tree/main. I put both AppDelegate.m and AppDelegate.h, and also main.m inside it. Thank You!! – Potamir Apr 18 '22 at 15:50
  • oh nvm, I just comment most of them and it just magically worked. Thank you!! – Potamir Apr 18 '22 at 16:01
  • You are welcome (Y) – Soban Arshad Apr 18 '22 at 20:14
  • I have another question please, now it produce this error after complete building metro bundler "TypeError: null is not an object (evaluating 'NativeUnimoduleProxy.viewManagersNames')" – Potamir Apr 19 '22 at 05:07
  • https://imgur.com/a/HzOMTI8 – Potamir Apr 19 '22 at 05:09
  • 1
    you aren't using uni modules anymore, check your image remove unicodes?.something, though m not sure but a rough guess. – Soban Arshad Apr 19 '22 at 21:13
4

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
Robert Loh
  • 41
  • 1
  • PS: you dont have to downgrade react-native-unimodules, you just need to install the expo-permissions and run pod install to link it. – Robert Loh Sep 24 '21 at 09:41
  • is it still working for you? @robert-loh – AlexUA Oct 23 '21 at 07:15
  • Funnily enough, I got 12 duplicate symbols instead of 7 after following your instructions. What version of expo-permissions did you install? – jperl Dec 06 '21 at 11:08
  • @Olek yes, mine still working, no issue so far. – Robert Loh Dec 07 '21 at 13:57
  • @jperl this is all my expo related dependencies version: > "expo": "42.0.3", > "expo-asset": "8.3.3", > "expo-av": "9.2.3", > "expo-barcode-scanner": "10.2.2", > "expo-camera": "11.2.2", > "expo-font": "9.2.1", > "expo-linear-gradient": "9.2.0", > "expo-splash-screen": "0.11.4", > "expo-status-bar": "1.0.4", > "expo-updates": "0.8.5", > "expo-video-thumbnails": "5.2.0", – Robert Loh Dec 07 '21 at 14:01
  • I just removed expo-permissions recently due to deprecated issue. – Robert Loh Dec 07 '21 at 14:05
  • FYI, my react-native-unimodules version currently is 0.14.8 – Robert Loh Dec 07 '21 at 14:06
-1

Try to upgrade expo-permissions to latest version

alx
  • 74
  • 3