react-native-maps: Xcode Build Error: "underlying Objective-C module 'GoogleMapsUtils' not found"
Summary
Hello,
I encountered a build issue on Xcode with the error “underlying Objective-C module ‘GoogleMapsUtils’ not found” while using the react-native-maps library. Here is my config:
Xcode Version: 14.3
package.json:
{
"name": "projectName",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@adrianso/react-native-device-brightness": "^1.2.5",
"@invertase/react-native-apple-authentication": "^2.2.0",
"@react-native-async-storage/async-storage": "^1.15.7",
"@react-native-community/datetimepicker": "^5.1.0",
"@react-native-community/geolocation": "^2.0.2",
"@react-native-community/push-notification-ios": "^1.10.1",
"@react-native-google-signin/google-signin": "^7.2.2",
"@react-native-picker/picker": "^2.3.1",
"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/native": "^6.0.2",
"@react-navigation/stack": "^6.0.7",
"@stripe/stripe-react-native": "^0.18.1",
"@turf/random": "^6.5.0",
"add": "^2.0.6",
"luxon": "^3.3.0",
"react": "17.0.2",
"react-native": "0.67.1",
"react-native-calendars": "^1.1294.0",
"react-native-camera": "^4.2.1",
"react-native-config": "1.5.0",
"react-native-fast-image": "^8.5.11",
"react-native-fbsdk-next": "^10.1.0",
"react-native-gesture-handler": "^2.3.1",
"react-native-google-places-autocomplete": "^2.4.1",
"react-native-haptic-feedback": "^1.13.1",
"react-native-iap": "^9.0.4",
"react-native-image-picker": "^4.7.3",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^2.2.0",
"react-native-map-clustering": "^3.4.2",
"react-native-maps": "^0.30.1",
"react-native-modal": "^13.0.0",
"react-native-permissions": "3.2.0",
"react-native-qrcode-scanner": "^1.5.5",
"react-native-qrcode-svg": "^6.1.2",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.6.0",
"react-native-sensitive-info": "^5.5.8",
"react-native-snap-carousel": "^3.9.1",
"react-native-star-rating": "^1.1.0",
"react-native-svg": "^12.1.1",
"react-native-swipe-gestures": "^1.0.5",
"react-native-toast-message": "^2.1.1",
"react-native-vector-icons": "^9.1.0",
"react-native-version-number": "^0.3.6",
"react-native-video": "^5.2.0",
"react-native-webview": "^11.18.1",
"react-redux": "^7.2.4",
"redux": "^4.1.1",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.13.14",
"@babel/runtime": "^7.13.10",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.23.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
Podfile :
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
def shared_pods
use_frameworks!
rn_maps_path = '../node_modules/react-native-maps' # This path is likely to be `../node_modules/react-native-maps` in your own project.
pod 'react-native-maps', path: rn_maps_path
pod 'react-native-google-maps', path: rn_maps_path # Remove this line if you don't want to support GoogleMaps on iOS
config = use_native_modules!
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
pod 'GoogleSignIn', '~> 6.1.0'
end
target 'projectName' do
project 'projectName',
'Dev-Debug' => :debug,
'Dev-Release' => :release,
'QA-Debug' => :debug,
'QA-Release' => :release,
'Prod-Debug' => :debug,
'Prod-Release' => :release,
'AppStore' => :release
shared_pods
target 'projectNameTests' do
inherit! :complete
# Pods for testing
end
end
ENVFILES = {
'Dev-Debug' => '$(PODS_ROOT)/../../.env.dev',
'Dev-Release' => '$(PODS_ROOT)/../../.env.dev',
'QA-Debug' => '$(PODS_ROOT)/../../.env.qa',
'QA-Release' => '$(PODS_ROOT)/../../.env.qa',
'Prod-Debug' => '$(PODS_ROOT)/../../.env.prod',
'Prod-Release' => '$(PODS_ROOT)/../../.env.prod',
'AppStore' => '$(PODS_ROOT)/../../.env.prod',
}
#Fix for incompatible libraries with use_frameworks!
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if pod.name.eql?('react-native-sensitive-info') || pod.name.eql?('react-native-version-number') || pod.name.eql?('RNSVG') || pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-') || pod.name.eql?('react-native-google-maps') || pod.name.eql?('Google-Maps-iOS-Utils') || pod.name.eql?('react-native-geolocation') ||
pod.name.eql?('BVLinearGradient') || pod.name.eql?('react-native-device-brightness')
def pod.build_type;
Pod::BuildType.static_library
end
end
end
end
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
if target.name == 'react-native-config'
config.build_settings['ENVFILE'] = ENVFILES[config.name]
end
end
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
if target.name == "React"
target.remove_from_project
end
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
end
Reproducible sample code
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
def shared_pods
use_frameworks!
rn_maps_path = '../node_modules/react-native-maps' # This path is likely to be `../node_modules/react-native-maps` in your own project.
pod 'react-native-maps', path: rn_maps_path
pod 'react-native-google-maps', path: rn_maps_path # Remove this line if you don't want to support GoogleMaps on iOS
config = use_native_modules!
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
pod 'GoogleSignIn', '~> 6.1.0'
end
target 'projectName' do
project 'projectName',
'Dev-Debug' => :debug,
'Dev-Release' => :release,
'QA-Debug' => :debug,
'QA-Release' => :release,
'Prod-Debug' => :debug,
'Prod-Release' => :release,
'AppStore' => :release
shared_pods
target 'projectNameTests' do
inherit! :complete
# Pods for testing
end
end
ENVFILES = {
'Dev-Debug' => '$(PODS_ROOT)/../../.env.dev',
'Dev-Release' => '$(PODS_ROOT)/../../.env.dev',
'QA-Debug' => '$(PODS_ROOT)/../../.env.qa',
'QA-Release' => '$(PODS_ROOT)/../../.env.qa',
'Prod-Debug' => '$(PODS_ROOT)/../../.env.prod',
'Prod-Release' => '$(PODS_ROOT)/../../.env.prod',
'AppStore' => '$(PODS_ROOT)/../../.env.prod',
}
#Fix for incompatible libraries with use_frameworks!
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if pod.name.eql?('react-native-sensitive-info') || pod.name.eql?('react-native-version-number') || pod.name.eql?('RNSVG') || pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-') || pod.name.eql?('react-native-google-maps') || pod.name.eql?('Google-Maps-iOS-Utils') || pod.name.eql?('react-native-geolocation') ||
pod.name.eql?('BVLinearGradient') || pod.name.eql?('react-native-device-brightness')
def pod.build_type;
Pod::BuildType.static_library
end
end
end
end
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
if target.name == 'react-native-config'
config.build_settings['ENVFILE'] = ENVFILES[config.name]
end
end
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
if target.name == "React"
target.remove_from_project
end
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
end
Steps to reproduce
XCode 14.3 react-native 0.67.1 react-native-maps 0.30.1
Expected result
Build success
Actual result
Build failed
React Native Maps Version
0.30.1
What platforms are you seeing the problem on?
iOS (Apple Maps)
React Native Version
0.67.1
What version of Expo are you using?
Not using Expo
Device(s)
Iphone 13
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
Same error here, after upgrading from 14.2 to XCode 14.3 on M1, RN version: 0.71.6
Why is this error closed? It’s happening to me as well.
I upgraded Xcode to version 15 and updated IPHONEOS_DEPOYMENT_TARGET to 13. started seeing this issue and no idea how to fix it.
I fixed it by setting build library for distribution flag to NO for the impacted pod dependencies