【发布时间】:2019-02-03 16:02:46
【问题描述】:
我使用命令 react-native init appName 创建了新的 react native 应用程序。 应用程序创建成功后,使用命令 react-native run-android 将其安装到我的设备中,它安装成功,并且工作正常...没问题
但是一旦我安装了反应导航和手势处理程序,我在运行命令 react-native run-android 后收到 Command failed: gradlew.bat installDebug 错误 我不知道出了什么问题……我以前的 react 原生项目运行良好。
我记得昨天我在我的一个旧项目中运行了命令 gradlew clean。这对我的新项目有影响吗?
如果有人帮忙,我会非常感激
这是完全错误
FAILURE: Build failed with an exception.
* Where:
Settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle' line: 3
* What went wrong:
Could not compile settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle'.
> startup failed:
settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle': 3: unexpected char: '\' @ line 3, column 133.
s\react-native-gesture-handler\android')
^
1 error
* 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 1s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnAllDevices (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
【问题讨论】:
-
你链接
react-native-gesture-handler了吗? -
是的,我做了链接...
-
你修改
MainActivity.java了吗? -
是的,我按照反应导航文档中的说明做了...添加了一些文件
-
发布了完整的错误...它在 settings.gradle 文件中说一些问题,但它与我的旧项目相同
标签: react-native react-navigation gesture