我无法在Android的Expo环境上运行React Native应用

时间:2019-10-01 14:07:37

标签: reactjs react-native react-native-android expo

我无法在Android的Expo环境上运行React Native应用;在我的Android手机上的Expo上运行该应用程序时会引发此错误:

Something went wrong.
32.0.0 is not a valid sdk version. Options are 35.0.0, 34.0.0, 33.0.0, UNVERSIONED.

同一应用程序可以在我的iOS手机上的Expo环境中完美运行。

我从MAC启动“ expo start”,并将两部手机连接到与MACBOOK PRO相同的WIFI。

这是我的app.json文件:

{
  "expo": {
    "name": "travel-management-app",
    "slug": "travel-management-app",
    "description": "Travel management application",
    "privacy": "public",
    "sdkVersion": "32.0.0",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "1.0.0",
    "orientation": "portrait",
    "primaryColor": "#cccccc",
    "icon": "./assets/icons/bg_screen5_square.png",
    "splash": {
      "image": "./assets/icons/bg_screen5.png"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    }
  }
}

这是我的package.json文件:

{
  "name": "travel-management-app",
  "version": "1.0.0",
  "description": "Travel management Application",
  "author": "Luchian Chivoiu",
  "private": true,
  "homepage": "https://www.sienna.ro",
  "main": "src/index.native.js",
  "dependencies": {
    "@babel/polyfill": "^7.2.5",
    "@expo/vector-icons": "^9.0.0",
    "expo": "^32.0.0",
    "expo-linear-gradient": "^3.0.0",
    "gh-pages": "^2.0.1",
    "lodash": "^4.17.4",
    "material-ui": "^0.20.2",
    "prop-types": "^15.7.2",
    "react": "16.5.0",
    "react-art": "^16.8.3",
    "react-autowhatever": "^10.2.0",
    "react-dom": "^16.8.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
    "react-native-autocomplete-input": "^4.1.0",
    "react-native-elements": "^1.0.0-beta8",
    "react-native-gesture-handler": "1.0.17",
    "react-native-gesture-handler-web": "npm:react-native-gesture-handler@1.1.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-picker-select": "^6.3.3",
    "react-native-ratings": "^6.3.0",
    "react-native-touchable-scale": "2.0.0",
    "react-native-vector-icons": "^6.3.0",
    "react-native-web": "^0.10.0",
    "react-navigation": "^3.5.1",
    "react-navigation-animated-switch": "^0.2.1",
    "react-redux": "6.0.1",
    "react-scripts": "^2.1.5",
    "react-select": "^3.0.4",
    "redux": "^4.0.4",
    "redux-thunk": "^2.3.0"
  },
  "scripts": {
    "web": "react-app-rewired start",
    "native": "expo start",
    "build:web": "react-app-rewired build",
    "deploy": "gh-pages -d build",
    "build:android": "expo ba",
    "build:ios": "expo bi",
    "eject:web": "react-scripts eject",
    "eject:native": "expo eject",
    "prettify": "prettier --write 'src/**/*.js'",
    "clean-install": "rm -rf node_modules && npm cache clean --force && watchman watch-del-all && yarn"
  },
  "devDependencies": {
    "@babel/plugin-proposal-class-properties": "^7.3.4",
    "babel-preset-expo": "^5.0.0",
    "customize-cra": "^0.2.12",
    "prettier": "^1.15.3",
    "react-app-rewired": "^2.1.0"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

package-lock.json包含以下内容:

"react-native": {
      "version": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
      "integrity": "sha512-+taJh7bN2owmwaZpJUrNpHdmPAL6ZynNCZj15uLQgjaPFq0ZBIG2ZWuSJ48eGoUjAb3lrWxkmLlHb2eJFXc7sQ==",

我如何也可以在Android上使用此功能?几天前,这个应用程序在我的Android手机上的expo上运行,直到我进行了一些软件包更新。

我已经更新了一些东西,一些软件包,一个软件包,也许使这个Android expo应用程序无法运行。

1 个答案:

答案 0 :(得分:1)

您正在使用过时的Expo SDK和应用程序,不再维护SDK 32及以下版本。

按照此link上的说明进行操作

希望这会有所帮助!