首页 > 解决方案 > React Native on Android:无法确定当前字符,它不是字符串、数字、数组或对象

问题描述

我创建一个应用程序并插入代码,当我构建应用程序时出现此错误:

脚本 'C:\Users\nameuser\Desktop\nameapp\node_modules@react-native-community\cli-platform-android\native_modules.gradle'行:191

什么地方出了错:

评估设置“ nameapp ”时出现问题。

无法确定当前字符,它不是字符串、数字、数组或对象

当前读取的字符是 'i',int 值为 105
无法确定当前字符,不是字符串、数字、数组或对象
行号 1
索引号 0
info 运行“react-native --help”到查看所有可用命令的列表。

使用react-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"
    ]
  }
}

感谢您的帮助。

标签: androidreact-nativeandroid-studioandroid-studio-3.0

解决方案


我不得不删除app\build\intermediates\signing_config\debug\out\signing-config.json,现在它可以工作了。

参考:https ://gitmemory.com/issue/facebook/react-native/25936/517993846


推荐阅读