我创建一个新应用程序并插入一个旧代码,当我构建该应用程序出现此错误:
脚本'C:\ Users \ nameuser \ Desktop \ nameapp \ node_modules @ react-native-community \ cli-platform-android \ native_modules.gradle'行:191
出了什么问题:
评估设置'nameapp'时出现问题。
无法确定当前字符,它不是字符串,数字,数组或对象
当前读取的字符为'i',int值为105无法确定当前字符,它不是字符串,数字,数组,或对象行号1索引号0信息运行“ react-native --help”以查看所有可用命令的列表。
使用native-native info命令,我有当前情况:
info
React Native Environment Info:
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Memory: 6.46 GB / 15.85 GB
Binaries:
Yarn: 1.15.2 - C:\laragon\bin\nodejs\node-v11\yarn.CMD
npm: 6.12.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5900203
并且在package.json上:
{
"name": "nameapp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"@react-native-community/cli-platform-android": "^2.9.0",
"axios": "^0.18.0",
"haversine": "^1.1.0",
"moment": "^2.22.2",
"react": "16.6.3",
"react-native": "^0.59.8",
"react-native-actionsheet": "^2.4.2",
"react-native-auto-height-image": "^1.1.0",
"react-native-cached-image": "^1.4.3",
"react-native-cli": "^2.0.1",
"react-native-fbsdk": "^0.8.0",
"react-native-global-font": "^1.0.2",
"react-native-google-places": "^3.0.5",
"react-native-image-crop-picker": "^0.24.1",
"react-native-image-pan-zoom": "^2.1.10",
"react-native-image-placeholder": "^1.0.14",
"react-native-iphone-x-helper": "^1.2.0",
"react-native-keyboard-manager": "^4.0.13-10",
"react-native-maps": "github:react-community/react-native-maps",
"react-native-maps-super-cluster": "^1.4.1",
"react-native-modal-datetime-picker": "^5.1.0",
"react-native-open-maps": "^0.3.3",
"react-native-progress": "^3.4.0",
"react-native-push-notification": "^3.1.2",
"react-native-router-flux": "^4.0.6",
"react-native-share": "^1.2.1",
"react-native-snap-carousel": "^3.7.4",
"react-native-swiper": "^1.5.13",
"react-native-vector-icons": "^4.6.0",
"react-native-view-shot": "^2.5.0",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"redux-persist": "^4.10.1",
"redux-persist-transform-filter": "0.0.15",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./src/fonts"
]
}
}
感谢您的帮助。
构建过程执行:
npx --quiet react-native config要么npx.cmd --quiet react-native config
该命令,如果您在项目的根目录中执行,将产生JSON输出(如果一切配置正确)。
然后,在您引用的gradle脚本中解析JSON输出。如果没有正确配置,npx --quiet react-native config将不产生任何结果或无效的输出。因此,JSON解析(第191行)将失败。
调用'npx --quiet react-native config'的整个机制在最新版本的react-native中使用,因此它将自动将您package.json中拥有的所有react native软件包“绑定”到您的Android Java应用。(它基本上会在应用编译时注入所有这些包名称)。
-
[遗憾的是,没有一个'解决方法'可以帮助您解决此问题。您可能有不匹配项(或配置有误)
我目前推荐的最好的方法是升级到最新版本您可以负担得起的React版本,然后使用
https://github.com/react-native-community/rn-diff-purge
要找出在工作版本和停止工作的RN版本之间进行上述配置文件所需的所有更改。