安装反应导航和手势处理程序后出现错误 gradlew.bat installDebug
getting error gradlew.bat installDebug after installing react navigation and gesture handler
我使用命令 react-native init appName 创建了新的 React Native 应用程序。
在应用程序创建成功后,使用命令 react-native 运行-android 在我的设备中安装它,它安装成功,并且工作正常......没有问题
但是当我安装 React 导航和手势处理程序时,我收到 Command failed: gradlew.bat installDebug after 运行ning command react-原生 运行-android
我不知道出了什么问题...我的旧 React Native 项目工作得很好。
我记得昨天我在我的一个旧项目中 运行 命令 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)
哦,是的,我认为这是 RN 0.58 link 命令的一个错误
使用来自 => 'D:\React Native Apps\Practice\newapp\android\settings.gradle'
的文本编辑器打开 settings.gradle
将所有 '\' 替换为 '/' ,在我的例子中,我必须将 '..\node_modules\react-native-gesture-handler\android' 替换为 '../node_modules/react-native-gesture-handler/android'
然后 react-native 运行-android
确保您已经安装了 python 2 和最新版本 jdk 并确保您已经设置了 ANDROID_HOME
你应该遵循这个结构:https://facebook.github.io/react-native/docs/getting-started.html
我使用命令 react-native init appName 创建了新的 React Native 应用程序。 在应用程序创建成功后,使用命令 react-native 运行-android 在我的设备中安装它,它安装成功,并且工作正常......没有问题
但是当我安装 React 导航和手势处理程序时,我收到 Command failed: gradlew.bat installDebug after 运行ning command react-原生 运行-android 我不知道出了什么问题...我的旧 React Native 项目工作得很好。
我记得昨天我在我的一个旧项目中 运行 命令 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)
哦,是的,我认为这是 RN 0.58 link 命令的一个错误
使用来自 => 'D:\React Native Apps\Practice\newapp\android\settings.gradle'
的文本编辑器打开 settings.gradle将所有 '\' 替换为 '/' ,在我的例子中,我必须将 '..\node_modules\react-native-gesture-handler\android' 替换为 '../node_modules/react-native-gesture-handler/android'
然后 react-native 运行-android
确保您已经安装了 python 2 和最新版本 jdk 并确保您已经设置了 ANDROID_HOME 你应该遵循这个结构:https://facebook.github.io/react-native/docs/getting-started.html