Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoogleMaps SPM integration: Error: module 'GoogleMaps' not found #10

Open
Tracked by #146920 ...
FrankWuoO opened this issue Feb 7, 2024 · 10 comments
Open
Tracked by #146920 ...

GoogleMaps SPM integration: Error: module 'GoogleMaps' not found #10

FrankWuoO opened this issue Feb 7, 2024 · 10 comments
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@FrankWuoO
Copy link

FrankWuoO commented Feb 7, 2024

Environment details

  1. GitHub Action
  2. Xcode 14.2
  3. iOS-maps-sdk 8.4.0 via SPM
截圖 2024-02-07 上午9 36 50
  1. fastlane gym 2.219.0
  2. build simulator iPhoneOS16.2.sdk

Steps to reproduce

  1. Execute Fastlane on GitHub Action
    build_app(
      scheme: "APP_Scheme",
      configuration: "APP_Configuration",
      clean: true,
      skip_archive: true,
      skip_package_ipa: true
    )
  1. It will show ** BUILD FAILED **

Screenshot

截圖 2024-02-07 上午9 42 04
@FrankWuoO FrankWuoO added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 7, 2024
@wangela
Copy link
Member

wangela commented Feb 7, 2024

If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.

@FrankWuoO Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

@dogahe
Copy link
Collaborator

dogahe commented Feb 7, 2024

Can you please clean build folder, clean, and build from Xcode first and let us know if you can successfully build and run your app on Xcode first?

@FrankWuoO
Copy link
Author

Sure, it was successful building on Xcode 15.1 locally.
Now, I'd like to attempt building on the same Xcode version (14.1) as GitHub Actions, but I can't due to MacOS Sonoma not allowing its installation. 😢
截圖 2024-02-07 下午3 24 45

@dogahe
Copy link
Collaborator

dogahe commented Feb 7, 2024

I just verified with both Xcode 14.0.1 and 14.2 that the Swift package for GoogleMaps works properly. Please make sure you follow the steps from https://developers.google.com/maps/documentation/ios-sdk/config#swift-package-manager and let me know what's the error that you are encountering?

@jeffbadorek
Copy link

We use xcode 15 locally, but Xcode 14.2 on CI (azure)....on the server, it is now failing consistently. It used to work every once in a while (failing more times than not) but now, since I changed the SPM cache key, which is forcing a rebuild of all SPM packages, it fails every time. I feel like the builds that were succeeding may have been picking up the binary from cocoapods cache. Just a theory.

I even tried pinning to 8.3.1...same error

[GoogleMapsCoreTarget] Compiling GMSEmpty.m
❌ /Users/runner/work/1/s/ios/SPM/checkouts/ios-maps-sdk/Core/GMSEmpty.m:17:9: module 'GoogleMaps' not found
@import GoogleMaps;
 ~~~~~~~^~~~~~~~~~

We can't quite switch to xcode 15 on CI because of ongoing performance issues with xcode and running tests.

I feel like "@import GoogleMaps" in the dummy files is causing this issue. And I'm not entirely convinced it's needed.

@icecoffin
Copy link

We experience the same issue. Ended up making a fork and replacing GMSEmpty.m with GMSEmpty.swift and removing the GoogleMaps import (so the files are completely empty).

@vashworth
Copy link

vashworth commented May 6, 2024

Flutter is experiencing the same issue: flutter/packages#6639 (comment)

So I believe this is a race condition, which is why it doesn't always occur. This applies to GoogleMapsCoreTarget, GoogleMapsBaseTarget, and GoogleMapsM4BTarget, but let's look at GoogleMapsCoreTarget as an example.

If you look at GoogleMapsCoreTarget, it uses the GoogleMaps module:

@import GoogleMaps;

However, it does not have a dependency on the GoogleMaps or GoogleMapsTarget target:

.target(
name: "GoogleMapsCoreTarget",
dependencies: ["GoogleMapsCore"],
path: "Core",
sources: ["GMSEmpty.m"],
publicHeadersPath: "Sources"
),

Therefore, Swift Package Manager/Xcode may possibly compile sources from GoogleMapsCoreTarget before the GoogleMaps.xcframework is done processing, which can cause the module 'GoogleMaps' not found error

Screenshot 2024-05-06 at 3 34 53 PM

FYI: You can view the build timeline like above screenshot in Xcode via Editor > Assistant

I believe solution would be to add either GoogleMapsCoreTarget or GoogleMaps as dependency of GoogleMapsCoreTarget, GoogleMapsBaseTarget, and GoogleMapsM4BTarget.

@wangela
Copy link
Member

wangela commented Sep 5, 2024

@vashworth @FrankWuoO Is this still occurring for you with Maps SDK for iOS v9.x? When upgrading versions, note the special instructions about removing the GoogleMapsBase, GoogleMapsCore, and GoogleMapsM4B frameworks.

@icecoffin
Copy link

icecoffin commented Sep 23, 2024

@wangela I haven't tested it yet (because it would take a lot of time to test all of this and then revert it back), but I'm not sure how using v9.x would've solved it?

GoogleMapsTarget has a dependency on GoogleMaps (binary target), GoogleMapsBaseTarget (regular target), and GoogleMapsCoreTarget (regular target).
Both GoogleMapsBaseTarget and GoogleMapsCoreTarget contain GMSEmpty.h with the @import GoogleMaps statement. However, neither GoogleMapsBaseTarget nor GoogleMapsCoreTarget has a dependency on GoogleMaps or GoogleMapsTarget, so how can they import it? It's still the same issue described in the comment above: #10 (comment).

@FrankWuoO
Copy link
Author

@wangela Sorry for the late reply. I switched to the native MapKit, so I haven’t tested it since then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

6 participants