我添加了react-navigation和react-native-gesture-handler。当我使用react-native run-android运行项目时,出现以下错误:
Could not compile settings file 'C:\Users\pc\Desktop\GSTCalc\android\settings.gradle'.
> startup failed:
settings file 'C:\Users\pc\Desktop\Project\android\settings.gradle': 3: unexpected char: '\' @ line 3, column 133.
Following is the content of my settings.gradle file:
rootProject.name = 'GSTCalc'
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android')
include ':app'
我试图从项目文件夹中删除node-modules文件夹。并运行npm install。但是都是徒劳的。我该怎么办?提前致谢。
答案 0 :(得分:12)
我有同样的问题。
我的第一行(出现错误的行)是:
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android')
我将其更改为:
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
我重建了它,并且可以正常工作!希望这会有所帮助。
答案 1 :(得分:1)
通过添加以下内容可以起作用:
project(':react-native-gesture-handler').projectDir = new
File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')