React Native CLI安装Google Maps失败,编译报错求排查原因
Hey there! Let's break down why you're hitting this CompileC error with RCTDevSettings.mm while setting up Google Maps in React Native CLI, and how to fix it:
1. Version Mismatches Between React Native and Dependencies
This is the most common culprit. If your React Native version is out of sync with the react-native-maps library or other Pods, it can lead to syntax or API conflicts in files like RCTDevSettings.mm.
- Fix:
- Double-check the compatibility matrix for
react-native-mapsagainst your React Native version (you can find this directly in the library's README). - If versions don't align, either upgrade/downgrade React Native or switch to a compatible version of
react-native-maps. - Run
pod deintegratein your ios directory, thenpod installto refresh the Pods with the correct versions.
- Double-check the compatibility matrix for
2. Incomplete or Cached Pod Installations
Sometimes Pods don't install properly, or old cached files interfere with the build process.
- Fix:
- Delete the
Podsfolder andPodfile.lockin your ios directory:cd ios rm -rf Pods Podfile.lock - Clear Xcode's build cache: Go to Xcode > Product > Clean Build Folder (or press
Cmd+Shift+K). - Reinstall Pods with repo updates:
pod install --repo-update
- Delete the
3. Path Issues (Spaces in Your Project Directory)
Looking at your error path: /Volumes/DATA/React\ Native/Redux-React-Native/... — spaces in the project path can sometimes confuse Xcode's compiler when resolving file paths.
- Fix:
- Try moving your project to a directory without spaces (e.g.,
/Volumes/DATA/ReactNative/Redux-React-Native/instead ofReact Native). - After moving, re-run
pod installin the ios folder and rebuild the project.
- Try moving your project to a directory without spaces (e.g.,
4. Xcode Architecture Configuration Problems
The error mentions x86_64 (simulator architecture). If your Xcode project's architecture settings are misconfigured, it can cause compilation failures for simulator builds.
- Fix:
- Open your project in Xcode, go to your target's Build Settings.
- Search for
Architecturesand ensure it's set toStandard Architectures (arm64, x86_64)for the simulator. - Also check
Excluded Architectures— make sure it doesn't excludex86_64for the Debug-iphonesimulator configuration.
5. File Permission Issues
Rare but possible: the RCTDevSettings.mm file might have incorrect permissions preventing the compiler from accessing it.
- Fix:
- Navigate to the file path in your terminal:
cd node_modules/react-native/React/Modules/ - Set proper permissions:
chmod 644 RCTDevSettings.mm - Rebuild the project in Xcode.
- Navigate to the file path in your terminal:
After trying these steps, rebuild your project in Xcode or run npx react-native run-ios again. If the error persists, sharing the full, untruncated error log would help narrow it down further!
内容的提问来源于stack exchange,提问作者Sras

