【问题标题】:1 duplicate symbol for architecture armv7 in react nativereact native 中架构 armv7 的 1 个重复符号
【发布时间】:2020-02-10 05:46:18
【问题描述】:

在我将 push-notification-iosPush Notification ios 添加到项目后,我的 react-native 版本“0.61.5”和我的 xcode 版本为 11,我收到此错误:

duplicate symbol '_RCTRemoteNotificationReceived' in:
    .../Library/Developer/Xcode/DerivedData/myprojectname-busrrsxathritwfouhsiiyaolopv/Build/Products/Debug-iphoneos/RNCPushNotificationIOS/libRNCPushNotificationIOS.a(RNCPushNotificationIOS.o)
    .../Library/Developer/Xcode/DerivedData/myprojectname-busrrsxathritwfouhsiiyaolopv/Build/Products/Debug-iphoneos/React-RCTPushNotification/libReact-RCTPushNotification.a(RCTPushNotificationManager.o)
ld: 1 duplicate symbol for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我做这项工作,但得到这个错误:

1.clean project
2.claen pod
3.delete pods and install again 

这是我的 package.json:

"dependencies": {
    "@react-native-community/push-notification-ios": "^1.0.5",
    "axios": "^0.19.2",
    "fast-xml-parser": "^3.16.0",
    "he": "^1.2.0",
    "jalali-moment": "^3.3.3",
    "jetifier": "^1.6.5",
    "lodash": "^4.17.15",
    "native-base": "^2.13.8",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-collapsible": "^1.5.1",
    "react-native-device-info": "^5.5.1",
    "react-native-elements": "^1.2.7",
    "react-native-firebase": "^5.6.0",
    "react-native-gesture-handler": "^1.5.3",
    "react-native-maps": "^0.25.0",
    "react-native-material-dropdown": "git+https://github.com/harshitjee/react-native-material-dropdown.git",
    "react-native-popup-menu": "^0.15.6",
    "react-native-push-notification": "^3.1.9",
    "react-native-reanimated": "^1.7.0",
    "react-native-responsive-screen": "^1.3.1",
    "react-native-segmented-control-tab": "^3.4.1",
    "react-native-simple-table": "0.0.3",
    "react-native-table-component": "^1.2.1",
    "react-native-vector-icons": "^6.6.0",
    "react-navigation": "^3.13.0",
    "react-redux": "^7.1.3",
    "react-table": "^7.0.0-rc.15",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0"
  }

如何解决这个问题?谢谢你帮助我

更新: 这是错误的屏幕截图 更新 2: 这是构建阶段的屏幕截图:

【问题讨论】:

  • 您是否也手动链接了库?
  • @SamithaNanayakkara no

标签: reactjs react-native react-native-push-notification


【解决方案1】:

看到你的截图后,我觉得你应该试试这一步

在 Xcode -> Build Phases -> Link Binary With Libraries -> 删除 libRNCPushNotificationIOS.a

然后清理,构建你的项目

这应该可以工作

【讨论】:

  • 在这次溃败中我只有 libPods{project name}.a
  • 然后在链接库中单击 + 按钮并添加 libRNCPushNotificationIOS.a 然后清理构建您的项目
  • 我添加并清理并再次构建相同的错误。并再次删除,同样的错误。
  • 注意你的截图,它显示了两个需要添加的东西 libRCTPushNotification.a 和 libRNCPushNotificationIOS.a 一旦你这样做了,删除派生数据然后清理并再次构建项目。
  • 但是你为什么同时使用 libRNCPushNotificationIOS 和 libRCTPushNotification 呢?从包中删除其中一个,然后安装节点模块和所有其他步骤。我猜这两个库是冲突的
【解决方案2】:

这个错误意味着,“_RCTRemoteNotificationReceived”这个库或包被链接了不止一次,

react-native 取消链接

尝试删除节点模块

按照以下步骤操作:-

  • 纱线安装
  • cd ios
  • pod 安装
  • cd ..
  • react-native 链接

然后再次运行您的项目,但在遵循所有这些删除派生数据之前。

【讨论】:

  • @AmirFarahani 你能显示整个错误的截图吗?
  • 我添加了截图@RB RB
  • @AmirFarahani 我已经发布了另一个答案,请检查一下。
  • 由于 RN 0.60 及以上版本支持自动链接,因此无需运行 react native link。
猜你喜欢
  • 1970-01-01
  • 2013-05-01
  • 2012-11-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-02
  • 1970-01-01
  • 2021-10-14
相关资源
最近更新 更多