简体   繁体   English

React Native代码中的错误

[英]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.

相关问题 react native中的Expo代码总是出错 - Expo code in react native is always giving error 错误代码:React Native 0.56 for Android上的500 - error code: 500 on react native 0.56 for android 反应本机生产级别的代码和错误处理 - React Native Production level code and error handling React Native 运行时错误:未找到本机客户端。 Bugsnag React Native 是否安装在您的本机代码项目中? - React Native Runtime Error: No native client found. Is Bugsnag React Native installed in your native code project? 在Android设备中运行代码时在React Native中转换错误 - Transform error in react native when running code in android device React Native-开发服务器返回了Respose错误代码:404 - React native - The development server returned respose error code:404 React Native:开发服务器返回响应错误码 404 - React Native: The development server returned response error code 404 React Native App-开发服务器返回响应错误代码:500 - React Native App - The development server returned response error code: 500 React Native Android-开发服务器响应错误代码500 - React Native Android - development server response error code 500 开发服务器返回响应错误代码:500 in react native - The development server returned response error code: 500 in react native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM