我正在尝试在干净的React Native安装中设置Webview进行测试。这是我采取的步骤:
但是,它崩溃并显示以下内容:
$ react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* Where:
Settings file 'C:\Users\Lucas10\ReactNative\webview\android\settings.gradle' line: 3
* What went wrong:
Could not compile settings file 'C:\Users\Lucas10\ReactNative\webview\android\settings.gradle'.
> startup failed:
settings file 'C:\Users\Lucas10\ReactNative\webview\android\settings.gradle':3: unexpected char: '\' @ line 3, column 117.
e_modules\react-native-webview\android')
如果我编辑android / settings.graddle并替换:
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-webview\android')
使用
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '..\\node_modules\\react-native-webview\\android')
它可以正常编译。
这似乎是react-native和Windows之间的兼容性烦恼...?
如何解决此问题,这样就不必在每次添加软件包时都进行手动调整?