简体   繁体   English

React-Native 错误 ld:找不到 -lBVLinearGradient 的库

[英]React-Native error ld: library not found for -lBVLinearGradient

Installed 'react-native-lienar-gradient' library in my new react-native project.在我的新 react-native 项目中安装了“react-native-lienar-gradient”库。

Added pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient' in Podfile在 Podfile 中添加了 pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

Performed pod install in ios directory在 ios 目录中执行 pod install

Xcode build gives the following error: Xcode 构建会出现以下错误:

ld: warning: directory not found for option '-LL/Users/pavneet/Library/Developer/Xcode/DerivedData/Krowym-fttolxdorzfwjbcgjwmxijsnufkv/Build/Products/Debug-iphonesimulator/BVLinearGradient' ld: library not found for -lBVLinearGradient clang: error: linker command failed with exit code 1 (use -v to see invocation) ld:警告:找不到选项“-LL/Users/pavneet/Library/Developer/Xcode/DerivedData/Krowym-fttolxdorzfwjbcgjwmxijsnufkv/Build/Products/Debug-iphonesimulator/BVLinearGradient”的目录:链接器命令失败,退出代码为 1(使用 -v 查看调用)

Error in Xcode Xcode 中的错误

Tried deleting Podfile.lock, cleaning xcode build, manually linking library by react-native link command, deleting Derived data folder尝试删除 Podfile.lock,清理 xcode 构建,通过 react-native 链接命令手动链接库,删除派生数据文件夹

Also tried by adding libBVLinearGradient.a on Build Phases -> Link Binary With Libraries还尝试在 Build Phases -> Link Binary With Libraries 上添加 libBVLinearGradient.a

Environment环境

react-native:0.63.2反应原生:0.63.2

react-native-linear-gradient:2.5.6反应原生线性梯度:2.5.6

Can you try this.你可以试试这个。

First deintegrate and install the pods again先解体再安装pods

  1. sudo gem update –system
  2. sudo gem install -n /usr/local/bin cocoapods
  3. pod setup
  4. cd ios
  5. pod deintegrate
  6. pod install

And then go back and run the app by deleting ios build and watchman and clearing metro server and simulator cache and also deleting and reinstalling node modules然后通过deleting ios build and watchmanclearing metro server and simulator cache以及deleting and reinstalling node modules返回并运行应用程序

  1. cd ..
  2.  watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -fr $TMPDIR/metro-cache* && rm -fr $TMPDIR/haste-map-metro* && rm -rf ios/build && xcrun simctl erase all && rm -rf node_modules/ && npm cache verify && npm install && react-native run-ios -- --reset-cache

1-add this in pod file: pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient' 1-在 pod 文件中添加:pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

2-npx pod-install 2-npx pod-install

I know this is so late, I hope you've already solved your problem.我知道这么晚了,我希望你已经解决了你的问题。 However, this solution might help someone else.但是,此解决方案可能对其他人有所帮助。

  1. Quit Xcode.退出 Xcode。
  2. users/${username}/Library/Developer/Xcode/DerivedData go this directory and clean your project data. users/${username}/Library/Developer/Xcode/DerivedData转到此目录并清理您的项目数据。 (Make sure hidden files are visible to see Library file under users/${username} . Command+Shift+. combination switches hidden files visibility.) (确保隐藏文件可见以查看users/${username}下的Library文件Command+Shift+.组合切换隐藏文件可见性。)
  3. Open your terminal, change the current working directory to your local project directory/ios.打开终端,将当前工作目录更改为本地项目目录/ios。
  4. pod deintegrate and pod install again. pod deintegratepod install再次。
  5. Open your project .xcworkspace file in Xcode.在 Xcode 中打开您的项目 .xcworkspace 文件。
  6. Click on your project name on the left navigation bar and click your project name under PROJECT.单击左侧导航栏上的项目名称,然后单击 PROJECT 下的项目名称。
  7. Type Library Search Paths and search.键入Library Search Paths并搜索。
  8. Click twice on the path which is beside Library Search Paths and delete the first and the last quote characters.( enter image description here It should look like this.)Library Search Paths旁边的路径上单击两次并删除第一个和最后一个引号字符。(在此处输入图像描述它应该是这样的。)
  9. Lastly press Command+B to build your project.最后按Command+B来构建你的项目。

The version in pod file was platform :ios, '11.0' , but the deployment version was 9.0 . pod 文件中的版本是platform :ios, '11.0' ,但部署版本是9.0 Changed to 11.0 and the app could be achieved!改成11.0 ,app就可以实现了! 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM