Skip to content

[google_maps_flutter] iOS framework build fails: Module 'GoogleMapsUtilsObjC' not found #183441

Description

@email2sunilverma

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

  1. Create a Flutter module.
  2. Add the following dependency:
google_maps_flutter: ^2.14.2
  3. Run the command:
flutter build ios-framework --output=../FlutterFrameworks
  4. 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

pubspec.yaml

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: true
Code 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

  1. changed the title [-]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`[/+] on Mar 11, 2026
  2. stuartmorgan-g commented on Mar 11, 2026

    @stuartmorgan-g
    Contributor

    From the duplicate, the relevant verbose error logging is:

    ~/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.18.0/ios/google_maps_flutter_ios/Sources/google_maps_flutter_ios/include/google_maps_flutter_ios/GoogleMapsUtilsTrampoline.h:11:9: error: Module 'GoogleMapsUtilsObjC' not found (in target 'FlutterPluginRegistrant' from project 'Pods')
      ~/repos/ios_framework_example/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedPluginRegistrant.m:10:9: note: while building module 'google_maps_flutter_ios' imported from ~/repos/ios_framework_example/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedPluginRegistrant.m:10:
      ~/repos/ios_framework_example/.ios/Pods/<module-includes>:1:9: note: in file included from <module-includes>:1:
      ~/repos/ios_framework_example/.ios/Pods/Target Support Files/google_maps_flutter_ios/google_maps_flutter_ios-umbrella.h:17:9: note: in file included from ~/repos/ios_framework_example/.ios/Pods/Target Support Files/google_maps_flutter_ios/google_maps_flutter_ios-umbrella.h:17:
      ~/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.18.0/ios/google_maps_flutter_ios/Sources/google_maps_flutter_ios/include/google_maps_flutter_ios/FGMClusterManagersController.h:9:9: note: in file included from ~/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.18.0/ios/google_maps_flutter_ios/Sources/google_maps_flutter_ios/include/google_maps_flutter_ios/FGMClusterManagersController.h:9:
    ~/repos/ios_framework_example/.ios/Flutter/FlutterPluginRegistrant/Classes/GeneratedPluginRegistrant.m:10:9: error: Could not build module 'google_maps_flutter_ios' (in target 'FlutterPluginRegistrant' from project 'Pods')
    

    GoogleMapsUtilsTrampoline.h:11:9: error: Module 'GoogleMapsUtilsObjC' not found means that it's compiling with the wrong configuration; FGM_USING_COCOAPODS=1 is defined in the podspec, which should put us on the other codepath:

    // If Swift Package Manager is in use, Objective-C headers are available under the
    // GoogleMapsUtilsObjC package. When using CocoaPods, the headers are provided by the
    // GoogleMapsUtils package.
    #ifdef FGM_USING_COCOAPODS
    @import GoogleMapsUtils;
    #else
    @import GoogleMapsUtilsObjC;
    #endif

    @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_ios we could switch this to not have the ifdef, since it can only compile via CP, but that wouldn't help the _sdk* variants.)

  3. added
    platform-iosiOS applications specifically
    p: mapsGoogle Maps plugin
    packageflutter/packages repository. See also p: labels.
    team-iosOwned by iOS platform team
    on Mar 11, 2026
  4. added
    P1High-priority issues at the top of the work list
    triaged-iosTriaged by iOS platform team
    on Mar 12, 2026
  5. email2sunilverma commented on Mar 16, 2026

    @email2sunilverma
    Author

    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!

  6. stuartmorgan-g commented on Mar 16, 2026

    @stuartmorgan-g
    Contributor

    @email2sunilverma As a temporary workaround you can for google_maps_flutter_ios and make GoogleMapsUtilsTrampoline.h unconditionally include GoogleMapsUtils instead of having a conditional. That would make it not work with Swift Package Manager, but will fix your CocoaPods build.

  7. vashworth commented on Mar 18, 2026

    @vashworth
    Contributor

    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 Pods Xcode project:

    var pluginsBuildCommand = <String>[
    ...globals.xcode!.xcrunCommand(),
    'xcodebuild',
    '-alltargets',
    '-sdk',
    XcodeSdk.IPhoneOS.platformName,
    '-configuration',
    xcodeBuildConfiguration,
    'SYMROOT=${iPhoneBuildOutput.path}',
    'ONLY_ACTIVE_ARCH=NO', // No device targeted, so build all valid architectures.
    'BUILD_LIBRARY_FOR_DISTRIBUTION=YES',
    if (boolArg('static')) 'MACH_O_TYPE=staticlib',
    ];
    RunResult buildPluginsResult = await globals.processUtils.run(
    pluginsBuildCommand,
    workingDirectory: project.ios.hostAppRoot.childDirectory('Pods').path,
    );

    And in a Flutter module, we create a FlutterPluginRegistrant pod, which has a dependency on each plugin:

    const _pluginRegistrantPodspecTemplate = '''
    #
    # Generated file, do not edit.
    #
    Pod::Spec.new do |s|
    s.name = 'FlutterPluginRegistrant'
    s.version = '0.0.1'
    s.summary = 'Registers plugins with your Flutter app'
    s.description = <<-DESC
    Depends on all your plugins, and provides a function to register them.
    DESC
    s.homepage = 'https://flutter.dev'
    s.license = { :type => 'BSD' }
    s.author = { 'Flutter Dev Team' => '[email protected]' }
    s.{{os}}.deployment_target = '{{deploymentTarget}}'
    s.source_files = "Classes", "Classes/**/*.{h,m}"
    s.source = { :path => '.' }
    s.public_header_files = './Classes/**/*.h'
    s.static_framework = true
    s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
    s.dependency '{{framework}}'
    {{#methodChannelPlugins}}
    s.dependency '{{name}}'
    {{/methodChannelPlugins}}
    end
    ''';

    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 FlutterPluginRegistrant binary, but because it's not the GoogleMaps target, it's not passing the FGM_USING_COCOAPODS GCC_PREPROCESSOR_DEFINITIONS.

    @stuartmorgan-g Perhaps we could use the SWIFT_PACKAGE preprocessor macro instead of the custom FGM_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 the COCOAPODS=1 macro that's part of CocoaPods, but again we'd need to test how that passes through when it's built statically

  8. stuartmorgan-g commented on Mar 18, 2026

    @stuartmorgan-g
    Contributor

    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_include instead.

    We could probably also get rid of the static framework directive; I doubt the original reason still applies in a module-based world.

  9. vashworth commented on Mar 18, 2026

    @vashworth
    Contributor

    Ahh yes, #if __has_include would probably be better

  10. stuartmorgan-g commented on Mar 18, 2026

    @stuartmorgan-g
    Contributor

    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.

  11. vashworth commented on Mar 18, 2026

    @vashworth
    Contributor

    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.

    Why wouldn't it work? Couldn't you do:

    #if __has_include(<GoogleMapsUtils/GoogleMapsUtils.h>)
    @import GoogleMapsUtils;
    #else
    @import GoogleMapsUtilsObjC;
    #endif
    
  12. stuartmorgan-g commented on Mar 18, 2026

    @stuartmorgan-g
    Contributor

    Capturing from experimentation and offline discussion:

    • It's still not clear to me why, but I can't successfully gate GoogleMapsUtilsObjC imports on a __has_include of 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 #if targeting CocoaPods builds, because the SwiftPM build has both of these modules, but the things we need are in the ObjC version, which in turn depends on GoogleMapsUtils in its Swift.package)
    • Using COCOAPODS doesn'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.
    • Using SWIFT_PACKAGE didn'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_ios header unconditional. That will limit the breakage to just the combination of A2A + CocoaPods + explicitly opting into google_maps_flutter_ios_sdkN, which isn't a combination that I would expect anyone to actually need to use.

  13. email2sunilverma commented on Mar 24, 2026

    @email2sunilverma
    Author

    @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?

  14. stuartmorgan-g commented on Mar 24, 2026

    @stuartmorgan-g
    Contributor

    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

    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 override google_maps_flutter_ios to pull from the branch.

  15. email2sunilverma commented on Mar 25, 2026

    @email2sunilverma
    Author

    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

    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 override google_maps_flutter_ios to pull from the branch.

    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.

  16. github-actions commented on Apr 8, 2026

    @github-actions

    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 -v and a minimal reproduction of the issue.

  17. locked as resolved and limited conversation to collaborators on Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listp: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions