Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在react-native >= 0.60.2中,Android如果启用Hermes引擎会导致程序崩溃 #35

Open
LeviDeng opened this issue Jul 22, 2019 · 5 comments

Comments

@LeviDeng
Copy link

LeviDeng commented Jul 22, 2019

image

如上图所示,原因是包依赖中的jsrsasign使用了过时的API:RegExp.prototype.compile ,Hermes已经不再支持

react-native-alipay: https://github.com/0x5e/react-native-alipay/blob/master/index.js#L3
jsrsasign: https://github.com/kjur/jsrsasign/blob/d282c71cee92000c4807bcbf2212fedf3f22bd84/src/rsasign-1.2.js#L24

临时解决方案:在 node_modules/@0x5e/react-native-alipay/index.js 把jsressign和Alipay.sign删除,我没有在客户端中进行签名(你也不应该这样做),所以删除这个方法也不会造成影响

补充:如果在开发模式中开启Debug JS Remotely,这个错误不会发生,很奇怪

@LeviDeng LeviDeng changed the title 在react-native 0.60.2中,Android如果启用Hermes引擎会导致程序崩溃 在react-native >= 0.60.2中,Android如果启用Hermes引擎会导致程序崩溃 Jul 22, 2019
@MichaelHao25
Copy link

你的安卓版可以正常打包吗?我的打包报错了

@MichaelHao25
Copy link

image

@LeviDeng
Copy link
Author

@MichaelHao25 我可以打包,你的情况应该是另外一个问题,我倒没遇到过

@0x5e
Copy link
Owner

0x5e commented Jul 26, 2019

当时忘了是为啥,签名我还是特意加进来的呢。。😅可能自己有用到吧,不过确实不建议这么做。有什么折中的方法吗?
另外,已多年不写rn和android,欢迎提交pr :-)

@LeviDeng
Copy link
Author

LeviDeng commented Aug 6, 2019

@0x5e 我也不用签名,我们可以考虑换一个签名库,或者把签名的代码删除就好了。目前我在自己的项目里边把hermes禁用掉了,不是很稳定不敢用在生产环境,估计还需要一段时间

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants