android - 如何在 Android 上使用应用程序运行 react-native(使用 CRNA)
问题描述
我有一个使用 CRNA 创建的简单应用程序,它在 iOS 上运行良好,但在 Android 上失败。
这似乎与 Android OS 上缺少的 JSC 有关。我在项目中添加了“android-jsc”(https://github.com/facebook/android-jsc)dep,但没有任何改变。我错过了什么?
这是我的package.json
{
"name": "app",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-plugin-module-resolver": "^2.7.1",
"eslint": "^4.10.0",
"eslint-plugin-react": "^7.4.0",
"jest-expo": "^28.0.0",
"jest-immutable-matchers": "^2.0.1",
"react-native-scripts": "1.14.0",
"react-test-renderer": "16.4.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "REACT_NATIVE_ENV=development react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "REACT_NATIVE_ENV=test node node_modules/jest/bin/jest.js --watch",
"test_ci": "REACT_NATIVE_ENV=test node node_modules/jest/bin/jest.js"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"jsc-android": "224109.x.x",
"expo": "^29.0.0",
"immutable": "^3.8.2",
"momentjs": "^2.0.0",
"prop-types": "^15.6.1",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
"react-native-elements": "1.0.0-beta5",
"react-native-keyboard-aware-scroll-view": "^0.4.1",
"react-native-modal-datetime-picker": "^6.0.0",
"react-native-side-menu": "^1.1.3",
"react-native-vector-icons": "^4.6.0",
"react-navigation": "2.0.4",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-immutablejs": "^0.0.8",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"sentry-expo": "^1.9.0",
"validate": "^4.4.1"
}
}
解决方案
jsc-android
需要手动链接,与 Expo 不兼容。查看您的所有依赖项是否与 Expo 兼容。如果没有,您要么必须分离到 ExpoKit,要么寻找兼容的替代品。
编辑:经检查,您正在直接安装 react-native-vector-icons。它需要手动链接,但包含在 Expo 中。在这里查看说明。
推荐阅读
- php - 如何在所有虚拟主机中设置 php?
- javascript - react.js 如何在触发某些操作时重新渲染 App.js
- python - 如何在 Python 中使用 C API 获取对象 ID?
- python - 在已激活 WSL 的 Windows 下安装 Anaconda 2020.02 失败
- javascript - Node.js 不转发到服务器上的“Google Drive Login”,但在 localhost 上工作
- json - jq:数据非规范化
- python - 计算机视觉,重叠块以解决最终图像的连续性
- matlab - Matlab GUI 绘制区域大小规范
- python - 如何通过气流在 s3 中运行 python 脚本
- python - ACF 时间序列:ValueError:操作数无法与形状一起广播