[英]Error in React Native code
I want to learn React Native so i tried to follow the doc page of React Native React Native DOC 我想学习母语做出反应,所以我试图按照发生反应的原住民文档页面阵营本地DOC
I want to create an app in Native code so I followed the instruction. 我想用本机代码创建一个应用程序,所以我按照说明进行操作。 when I ran the app I got following errors:
当我运行该应用程序时,出现以下错误:
Looking at the Build Successful I was happy but when I checked my android emulator it was showing unexpected error. 看着构建成功,我很高兴,但是当我检查我的Android模拟器时,它显示了意外错误。
I have added the screenshot of the error in my android Logcat 我在Android Logcat中添加了错误屏幕截图
I tried to reset cache but it failed. 我试图重置缓存,但是失败了。
I am totally new at this so i didn't get why am i getting this error. 我对此完全陌生,所以我不明白为什么会收到此错误。 I searched by my self and there is another way to create a new app using expo.
我自行搜索,还有另一种使用expo创建新应用的方法。 Creating an app using expo and then ejecting will make the app to use Native code but after creating in expo it works perfectly fine but after ejecting it doesn't works.
使用expo创建应用程序然后退出将使该应用程序使用本机代码,但是在expo中创建后,它运行良好,但退出后则无效。
Any help is appreciated. 任何帮助表示赞赏。
Thank you. 谢谢。
Package.json Package.json
{
"name": "aowinas",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-react-native-stage-0": "^1.0.1",
"jest": "^23.2.0",
"jest-react-native": "^18.0.0",
"react-test-renderer": "16.3.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "jest"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"react": "16.3.1",
"react-native": "~0.55.2"
}
}
I was able to solve the problem using the following step: 我可以使用以下步骤解决问题:
react-native init AwesomeProject
cd AwesomeProject
react-native run-android
npm uninstall react-native
npm install --save react-native@0.55.4
react-native run-android
npm install --save babel-core@latest babel-loader@latest
npm uninstall --save babel-preset-react-native
npm install --save babel-preset-react-native@4.0.0
react-native run-android
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.