Hey! I am trying to use clustering in my GoogleMap...
# ios
e
Hey! I am trying to use clustering in my GoogleMaps screen and for that I need to install
Google-Maps-iOS-Utils
. I am using CocoaPods to be able to use the code in my Kotlin files. For GoogleMaps it works fine, but when I try to add the
Google-Maps-iOS-Utils
pod, I am getting errors. (I continue in thread)
1) The first problem is the version, the latest version (
v6.0.0
) requires
GoogleMaps 9.0
, and for some reason, my project can only install the version
8.0.0
, if I try to install the GoogleMaps pod with higher version (
8.3.0
,
8.3.1
,
8.4.0
,
9.0.0
,
9.1.0
and
9.1.1
) I get this error when I try to build in XCode:
Copy code
Showing All Errors Only
Failed to load XCFramework at '/Users/user/myproject/iosApp/Pods/GoogleMaps/Base/Frameworks/GoogleMapsBase.xcframework': 'HeadersPath' is not supported for a 'framework' in library 'ios-arm64'.
2) As I have to stay in the version
8.0.0
, the latest version compatible of
Google-Maps-iOS-Utils
is
v5.0.0
. So I add in my `Podfile`:
Copy code
# Uncomment the next line to define a global platform for your project
platform :ios, '16.0'

target 'iosApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks! :linkage => :static

  # Pods for iosApp
  pod 'shared', :path => '../shared'
  pod 'GoogleMaps', '8.0.0'
  pod 'Google-Maps-iOS-Utils', '5.0.0'
end
And in my
build.gradle
Copy code
cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        version = "1.0"
        ios.deploymentTarget = "16.0"
        podfile = project.file("../iosApp/Podfile")
        framework {
            baseName = "shared"
            isStatic = true
        }
        pod("GoogleMaps") {
            extraOpts += listOf("-compiler-option", "-fmodules")
        }
        pod("Google-Maps-iOS-Utils") {
            extraOpts += listOf("-compiler-option", "-fmodules")
        }
    }
I get the following errors when syncing the project (attached images). And when running in Xcode, everything looks to work fine until it gets the step:
Copy code
> Task :shared:cinteropGoogle_Maps_iOS_UtilsIosSimulatorArm64 FAILED


Showing All Issues
Exception in thread "main" java.lang.Error: /var/folders/qn/1f2__ymn7rx9382fc4hcxqth0000gn/T/7410914245776930564.m:1:9: fatal error: module 'Google_Maps_iOS_Utils' not found

	at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:328)

	at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:83)

	at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:15)

	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:578)

	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:322)

	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLibSafe(main.kt:244)

	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.access$processCLibSafe(main.kt:1)

	at org.jetbrains.kotlin.native.interop.gen.jvm.Interop.interop(main.kt:102)

	at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:49)

	at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:23)

	at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:44)
Did somebody of you guys faced this issue or understands what is going on? Just as information I am using Macbook Pro M3 (i mention it beause of the
arm-64
thing. Kotlin 2.0.21-RC Thanks in advance!
f
Which cocoapods version do you use? you shouldn’t include the pods inside gradle and the podfile, only the gradle is enough
you can specify the version of the pods in the gradle
e
I am using
1.15.2
of cocoa pods, before i was defining the version also in the gradle, I removed it to use the Podfile, all the totorials I saw where using the Podfile too, so I can remove it and it is supposed to work?
f
There is a bug I got the error :
:shared:appleMain: cinterop file: /.../shared/build/classes/kotlin/iosSimulatorArm64/main/cinterop/shared-cinterop-Google_Maps_iOS_Utils.klib does not exist
But the name of
shared-cinterop-Google_Maps_iOS_Utils.klib
doesn’t exist. The generated is
shared-cinterop-GoogleMaps.klib
, so It can’t work!
I guess, the
-
in the pod name is an issue here 😄
e
I don't know why, I was thinking about this and I had the feeling that it was something related with the name and this damned symbol, I don't even understand why to cal it like that instead of
GoogleMapsUtils
or similar
f
I’m looking for a solution 🙂
🙌 1
Cocoapods and xcode16 are currently not best friend. I can’t just do a pod init with xcode 16... Cocoapods is really in maintenance mode and fixing issues are really slow...
e
This is what it generates to me
And the error in Xcode:
Exception in thread "main" java.lang.Error: /var/folders/qn/1f2__ymn7rx9382fc4hcxqth0000gn/T/15385898055862265727.m:1:9: fatal error: module 'Google_Maps_iOS_Utils' not found
It really looks it can be because the difference between
Google_Maps_iOS_Utils
and
Google-Maps-iOS-Utils
f
@Enol Simón found it!
Copy code
pod("Google-Maps-iOS-Utils") {
    version = "~> 6.0.0"
    extraOpts += listOf("-compiler-option", "-fmodules")
    moduleName = "GoogleMapsUtils"
}
👌 1
The pod name “Google-Maps-iOS-Utils” doesn’t match with the moduleName “GoogleMapsUtils”. Cinterop can’t work like that. No ***** error about it on the output.
Then, don’t add this library inside your Podfile, the gradle is enough. You can call the libs from the swift code if you want.
e
Man I don't know where you leave, but i will take a plane and invite you to a beer wherever it is. Thank you very much for your help, I would never do it by myself. @François
🍻 1
j
Hello @François, @Enol Simón, been stuck on this for days. would you happen to have the map setup on some public project I can look at?
e
I'm sorry but my repository is private, however you can write me a PM, or write your specific problem in this thread, I can try to help you