【问题标题】:Build error when react-native run-android on app with no change在应用程序上 react-native run-android 时构建错误而没有变化
【发布时间】:2020-03-03 10:34:05
【问题描述】:

我有一个 react native 0.61 应用程序,它运行良好,但我知道并非没有任何变化。这是react-native run-android时的错误:

FAILURE: Build failed with an exception.

* Where:
Script 'C:\D\code\js\emps_fe7\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 182

* What went wrong:
A problem occurred evaluating script.
> Text must not be null or empty

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Script 'C:\D\code\js\emps_fe7\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 182

* What went wrong:
A problem occurred evaluating script.
> Text must not be null or empty

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s

    at checkExecSyncError (child_process.js:629:11)
    at execFileSync (child_process.js:647:13)
    at runOnAllDevices (C:\d\code\js\emps_fe7\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
    at buildAndRun (C:\d\code\js\emps_fe7\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
    at then.result (C:\d\code\js\emps_fe7\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

我所做的是从头开始重建项目并一个一个地添加每个模块。但是错误是完全相同的。该项目曾经很好,并且已经从中生成了apk。我有点迷失在这里可能会出什么问题。这里是package.json的依赖:

"dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "moment": "^2.24.0",
    "react": "16.9.0",
    "react-native": "0.61.4",
    "react-native-cli": "^2.0.1",
    "react-native-confirmation-code-field": "^4.1.0",
    "react-native-device-info": "^5.2.1",
    "react-native-elements": "^1.2.7",
    "react-native-gesture-handler": "^1.5.0",
    "react-native-gifted-chat": "^0.11.3",
    "react-native-keychain": "^4.0.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-modal": "^11.5.1",
    "react-native-modal-datetime-picker": "^7.6.0",
    "react-native-reanimated": "^1.4.0",
    "react-native-segmented-control-tab": "^3.4.1",
    "react-native-vector-icons": "^6.6.0",
    "react-native-video": "^5.0.2",
    "react-navigation": "^4.0.10",
    "react-navigation-stack": "^1.10.3",
    "react-navigation-tabs": "^2.5.6",
    "socket.io-client": "2.1.1"
  },

【问题讨论】:

标签: android react-native


【解决方案1】:

您好,请添加最新的 @react-native-community/cli-platform-android: "^3.0.3" 并删除以前的节点模块,然后运行 ​​npm install 在我的情况下,此问题已修复。 请检查下面的图片。因为新的 react native 需要本地安装 react native cli 而不是全局 react native cli。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-16
    • 1970-01-01
    相关资源
    最近更新 更多