react native 遇到的坑汇总篇

问题一

iOS:编译错误Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/b

解决方法如下:

在Build Settings 中,
将Apple LLVM compiler 4.1 - Language 中的
c++Standard Library 修改为 
libstdc++(GNU C++ standard library)

问题二

iOS错误 library not found for -lXXX
在react-native中的情况会不一样。

1.先搜索lXXX,我这边是RCTlipay。

2.然后在node_modules/react-native-alipay/ios/RCTAlipay 查看文件是否存在。

如果存在就排除react-native-alipay文件丢失问题。

npm install react-native-alipay

文件存在那么只需要再次绑定 就可以了

react-native link react-native-alipay

问题三

iOS错误 The executable was signed with invalid entitlements.
能使用模拟器,但无法在真机调试。是因为真机包需要证书才行。

问题解决:
1.证书是否有效。
2.排除第一点后,可以从新把证书删除再重新操作。

问题四

error: uncompiled PNG file passed as argument. Must be compiled first into .flat file..

> Task :app:generateBundledResourcesHashRelease
77e6e86e7395e480f9306d31f8921133fc767d658c06f8a18d37f8ba621f9ba5

/Users/wangwenjie/project/locals/locals-framework-master-plus/android/app/build/intermediates/res/merged/rel
ease/drawable-xhdpi/node_modules_reactnavigation_src_views_assets_backicon.png: error: uncompiled PNG file passed as argument. Must be compiled first into .flat file..
error: failed parsing overlays.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Failed to process resources, see aapt output above for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

问题解决:
gradle.properties 添加 android.enableAapt2=false

这显然与AAPT2问题,AAPT2是Gradle工具3.0中的新版本,
android.enableAapt2=false它实质上使用旧的aapt来获取资源。

问题五

/ios/bundle/index.ios.jsbundle: No such file or directory
这里写图片描述

问题解决:
修改AppDelegate.m中的jsCodeLocation,设置jsCodeLocation指向本地main.jsbundle文件

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"index.ios" withExtension:@"jsbundle"];

生成index.ios.jsbundle文件

react-native bundle --entry-file index.ios.js --bundle-output ./ios/bundle/index.ios.jsbundle --platform ios --assets-dest ./ios/bundle --dev false

持续补充。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值