我使用命令react-native init appName创建新的react本机应用程序。应用程序创建成功后,使用命令react-native run-android将其安装在我的设备中,它安装成功,并且工作正常......没问题
但是,一旦我安装反应导航和手势处理程序,我收到命令失败的错误:gradlew.bat installDebug运行命令后反应本机运行android我不知道什么是错的...我的旧反应原生项目工作正常精细。
我记得昨天我在我的一个旧项目中运行命令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链接命令的错误
使用=>'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 run-android
确保你已经安装了python 2和最后一个版本的jdk并确保你已经设置了ANDROID_HOME并且你应该遵循这个结构:https://facebook.github.io/react-native/docs/getting-started.html