Repository navigation
[google_maps_flutter] iOS framework build fails: Module 'GoogleMapsUtilsObjC' not found #183441
Description
Steps to reproduce
I am trying to generate iOS frameworks from a Flutter module using the flutter build ios-framework command. The build fails during the plugin compilation stage when the google_maps_flutter plugin is included.
This issue occurs only for iOS builds. The Android build works correctly with the same configuration.
The failure happens during the FlutterPluginRegistrant build step with a ScanDependencies error referencing GeneratedPluginRegistrant.m.
Dependency
google_maps_flutter: ^2.14.2
Command Used
flutter build ios-framework --output=../FlutterFrameworks
Steps to Reproduce
- Create a Flutter module.
- Add the following dependency: google_maps_flutter: ^2.14.2
- Run the command: flutter build ios-framework --output=../FlutterFrameworks
- Observe the build failure during plugin compilation.
Environment
Flutter version: 3.41.4
Dart version: 3.11.1
DevTools version: 2.54.1
Xcode version: 26.3
macOS version: 15.7.3 (M1)
CocoaPods version: 1.16.2
Additional Notes
- The issue occurs only when generating iOS frameworks.
- Android builds successfully with the same dependency.
- The error occurs during the FlutterPluginRegistrant compilation phase.
Any guidance or suggested workaround would be appreciated.
Expected results
The command should successfully generate the Flutter iOS frameworks and compile all plugin frameworks, including google_maps_flutter.
Actual results
The build fails while compiling plugin frameworks.
Error output:
Unable to build plugin frameworks: ** BUILD FAILED **
The following build commands failed:
ScanDependencies
/Users/.../FlutterFrameworks/Debug/iphoneos/Pods.build/Debug-iphoneos/FlutterPluginRegistrant.build/Objects-normal/arm64/GeneratedPluginRegistrant.o
/Users/.../google_map_demo/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedPluginRegistrant.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(in target 'FlutterPluginRegistrant' from project 'Pods')
(1 failure)
Code sample
name: googlemapapp
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ^3.11.0
dependencies:
flutter:
sdk: flutter
google_maps_flutter: ^2.14.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: trueCode sample
main.dart
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool _showMap = false;
static const LatLng _initialTarget = LatLng(21.9974, 79.0011);
static final Set<Marker> _markers = {
Marker(
markerId: MarkerId('initial'),
position: LatLng(21.9974, 79.0011),
infoWindow: InfoWindow(title: 'Initial Location'),
),
Marker(
markerId: MarkerId('marker_2'),
position: LatLng(22.0574, 79.0511),
infoWindow: InfoWindow(title: 'Marker 2'),
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen),
),
Marker(
markerId: MarkerId('marker_3'),
position: LatLng(21.9474, 78.9511),
infoWindow: InfoWindow(title: 'Marker 3'),
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueBlue),
),
};
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: Center(
child: Column(
mainAxisAlignment: .center,
children: [
const Text('You have pushed the button this many times:'),
ElevatedButton(
onPressed: () => setState(() => _showMap = !_showMap),
child: Text(_showMap ? 'Hide Map' : 'Show Map'),
),
if (_showMap)
SizedBox(
height: 300,
width: double.infinity,
child: GoogleMap(
initialCameraPosition: const CameraPosition(
target: _initialTarget,
zoom: 12,
),
markers: _markers,
),
),
],
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
sunilverma@Sunils-MacBook-Pro-8304 google_map_demo % flutter build ios-framework --output=build/ios/framework
Building frameworks for com.example.googleMapDemo in debug mode...
├─Copying Flutter.xcframework... 144ms
├─Building App.xcframework... 5.5s
Running pod install... 1,865ms
├─Building plugins... 10.6s
Unable to build plugin frameworks: ** BUILD FAILED **
The following build commands failed:
ScanDependencies /Users/sunilverma/Desktop/untitled\ folder\
3/google_map_demo/build/ios/framework/Debug/iphoneos/Pods.build/Debug-iphoneos/FlutterPluginRegistrant.build/Object
s-normal/arm64/GeneratedPluginRegistrant.o /Users/sunilverma/Desktop/untitled\ folder\
3/google_map_demo/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedPluginRegistrant.m normal arm64 objective-c
com.apple.compilers.llvm.clang.1_0.compiler (in target 'FlutterPluginRegistrant' from project 'Pods')
(1 failure)
sunilverma@Sunils-MacBook-Pro-8304 google_map_demo %Flutter Doctor output
Doctor output
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.41.4, on macOS 15.7.4 24G517 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 26.3)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a
cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for iPhone 11. Ensure the device is unlocked and attached with a
cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for SDiPhone14. Ensure the device is unlocked and attached with a
cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for Iphone SE. Ensure the device is unlocked and attached with a
cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for Hardik’s iPhone. Ensure the device is unlocked and attached
with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• No issues found!
Activity
[-]iOS framework build fails with google_maps_flutter ^2.14.2 when running flutter build ios-framework[/-][+][google_maps_flutter] iOS framework build fails: `Module 'GoogleMapsUtilsObjC' not found`[/+]stuartmorgan-g commentedon Mar 11, 2026
From the duplicate, the relevant verbose error logging is:
GoogleMapsUtilsTrampoline.h:11:9: error: Module 'GoogleMapsUtilsObjC' not foundmeans that it's compiling with the wrong configuration;FGM_USING_COCOAPODS=1is defined in the podspec, which should put us on the other codepath:@vashworth since you've been looking at these build paths in general recently, any idea why we wouldn't be getting that define for this build mode?
(For
google_maps_flutter_ioswe could switch this to not have the ifdef, since it can only compile via CP, but that wouldn't help the _sdk* variants.)email2sunilverma commentedon Mar 16, 2026
Hi team,
Is there any update or tentative timeline for this issue?
This issue is currently blocking our iOS release pipeline. The Android platform works fine with the “add-to-app” approach, but the issue occurs on iOS.
At the moment, we are not in a position to change our project architecture or migrate to a different Maps SDK, so we would really appreciate any guidance or a potential workaround.
If there is any temporary solution, workaround, or a branch with a potential fix that we could try, please let us know so we can unblock our production pipeline.
We are currently affected in our production workflow and would be happy to help test a fix if needed.
Thanks for all the work on Flutter!
stuartmorgan-g commentedon Mar 16, 2026
@email2sunilverma As a temporary workaround you can for
google_maps_flutter_iosand makeGoogleMapsUtilsTrampoline.hunconditionally includeGoogleMapsUtilsinstead of having a conditional. That would make it not work with Swift Package Manager, but will fix your CocoaPods build.vashworth commentedon Mar 18, 2026
Okay so this appears to only happen for Flutter modules (aka
flutter create --template module).When we build the CocoaPods plugins into XCFrameworks, we build all targets of the
PodsXcode project:flutter/packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Lines 856 to 873 in 5e1be56
And in a Flutter module, we create a
FlutterPluginRegistrantpod, which has a dependency on each plugin:flutter/packages/flutter_tools/lib/src/flutter_plugins.dart
Lines 560 to 586 in 5e1be56
It's the building of this pod that is failing. I'm guessing that because GoogleMaps is a static framework that it gets compiled into the
FlutterPluginRegistrantbinary, but because it's not the GoogleMaps target, it's not passing theFGM_USING_COCOAPODSGCC_PREPROCESSOR_DEFINITIONS.@stuartmorgan-g Perhaps we could use the
SWIFT_PACKAGEpreprocessor macro instead of the customFGM_USING_COCOAPODS? It's unclear to me if that would pass through when built statically, though, so we need to test it. We could also add the macro on the SwiftPM side and see if that works. There's also theCOCOAPODS=1macro that's part of CocoaPods, but again we'd need to test how that passes through when it's built staticallystuartmorgan-g commentedon Mar 18, 2026
I carried that structure over from the original WIP PR that tried to add SwiftPM support and didn't think much about it. Now I'm wondering if we could just use
#if __has_includeinstead.We could probably also get rid of the static framework directive; I doubt the original reason still applies in a module-based world.
vashworth commentedon Mar 18, 2026
Ahh yes,
#if __has_includewould probably be betterstuartmorgan-g commentedon Mar 18, 2026
It seems like it may not work with modules unfortunately. Let's start with switching to COCOAPODS and see if that works; it's a simplification over the current approach regardless.
vashworth commentedon Mar 18, 2026
Why wouldn't it work? Couldn't you do:
stuartmorgan-g commentedon Mar 18, 2026
Capturing from experimentation and offline discussion:
GoogleMapsUtilsObjCimports on a__has_includeof one of its headers. I tried with<GoogleMapsUtilsObjC/GoogleMapsUtilsObjC.h>(thinking that should be generated, but it's not clear that it is) and with<GoogleMapsUtilsObjC/GMUCluster.h>. Maybe SwiftPM module builds just can't be checked via__has_include? (It has to be done this way, not with the#iftargeting CocoaPods builds, because the SwiftPM build has both of these modules, but the things we need are in theObjCversion, which in turn depends onGoogleMapsUtilsin its Swift.package)COCOAPODSdoesn't work because it is set at the Runner level, so messes up builds that use SwiftPM for Google Maps, but CocoaPods for another non-SwiftPM-supporting dependency.SWIFT_PACKAGEdidn't seem to work in SwiftPM builds for some reason.For now the plan is to do what I said at the end of this comment and make the
google_maps_flutter_iosheader unconditional. That will limit the breakage to just the combination of A2A + CocoaPods + explicitly opting intogoogle_maps_flutter_ios_sdkN, which isn't a combination that I would expect anyone to actually need to use.email2sunilverma commentedon Mar 24, 2026
@stuartmorgan-g
I have used the below commit version from the : branch:commits
google_maps_flutter:
git:
url: https://github.com/flutter/packages.git
ref: 0066b77ea703881c5a22f05633a796ea7b9c4b82
path: packages/google_maps_flutter/google_maps_flutter
but this is again failing to generate the iOS .xcframework, below is the complete error logs:
`google_map_demo % flutter build ios-framework --no-debug --no-profile --output=../FlutterFrameworks
Building frameworks for com.d.waveptxmodule in release
mode...
├─Copying Flutter.xcframework... 225ms
├─Building App.xcframework...
Font asset "MaterialIcons-Regular.otf" was tree-shaken,
reducing it from 1645184 to 1408 bytes (99.9% reduction).
Tree-shaking can be disabled by providing the
--no-tree-shake-icons flag when building your app.
├─Building App.xcframework...
Font asset "MaterialIcons-Regular.otf" was tree-shaken,
reducing it from 1645184 to 1408 bytes (99.9% reduction).
Tree-shaking can be disabled by providing the
--no-tree-shake-icons flag when building your app.
├─Building App.xcframework... 11.1s
Running pod install... 2,021ms
├─Building plugins... 27.0s
Unable to build plugin frameworks: ** BUILD FAILED **
The following build commands failed:
ScanDependencies
/Users/sunilverma/SourceCode/FlutterModuleDemo/FlutterFrame
works/Release/iphoneos/Pods.build/Release-iphoneos/FlutterP
luginRegistrant.build/Objects-normal/arm64/GeneratedPluginR
egistrant.o
/Users/sunilverma/SourceCode/FlutterModuleDemo/google_map_d
emo/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedP
luginRegistrant.m normal arm64 objective-c
com.apple.compilers.llvm.clang.1_0.compiler (in target
'FlutterPluginRegistrant' from project 'Pods')
(1 failure)
`
Could you please confirm if I’m missing any additional required setup for this commit and module-based ios-framework build?
stuartmorgan-g commentedon Mar 24, 2026
The changes in that branch are to
google_maps_flutter_ios, so this isn't doing anything. If you want to test that branch locally you need to overridegoogle_maps_flutter_iosto pull from the branch.email2sunilverma commentedon Mar 25, 2026
In this case how do we verify the changes without any modification in code from our side? is there any branch or tag that can we use and verify the same.
[google_maps_flutter] Fix A2A iOS builds (flutter#11290)
[google_maps_flutter] Fix A2A iOS builds (flutter#11290)
github-actions commentedon Apr 8, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[google_maps_flutter] Fix A2A iOS builds (flutter#11290)