为什么独立的本机应用程序无法正常运行,但在Expo Client上运行良好?如何解决?

时间:2019-03-30 15:31:02

标签: react-native expo

我正在构建一个React Native应用程序,在expo客户端上一切正常。但是我在启动屏幕后的日志中得到“未捕获的错误:调用AppRegistry.runApplication时出错”。

我添加了AppRegistry.registerComponent('main',()=> App),并且可以通过Expo客户端运行。我正在通过expo build:android创建SDK。

{
  "main": "App.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node ./node_modules/jest/bin/jest.js --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/samples": "2.1.1",
    "expo": "^32.0.0",
    "react": "16.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
    "react-native-elements": "^1.1.0",
    "react-native-material-cards": "^1.0.9",
    "react-native-shadow": "^1.2.2",
    "react-navigation": "^3.0.9",
    "typescript": "^3.4.1"
  },
  "devDependencies": {
    "babel-preset-expo": "^5.0.0",
    "jest-expo": "^32.0.0"
  },
  "private": true
}

1 个答案:

答案 0 :(得分:0)

当您输入“ expo init appname”时,您输入的名称是“ main”吗?

AppRegistry.registerComponent('AppName', () => componentName)

如果没有,请参考this link.

C:\Users\username\AppData\Local\Android\Sdk\platform-tools\ 从这里打开一个终端。然后输入adb reverse tcp:8081 tcp:8081