https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Andrii Yanechko

11/14/2023, 2:44 PM
👋 Hello, is that possible to install a
pod
into a kotlin KMM module and then include it into the
common
KMM module, which is the main KMM module ? The actual case I want to implement is in 🧵
1
So, I have a KMM application for JVM, Android and iOS targets and I want to implement a GoogleSignIn authentication, which would be implemented in a separate KMM module. Here is what I'm trying/willing to impelement:
Copy code
:google-sso
   - androidMain: implement("google-sign-in-android-dependency")
   - iOSMain: pod("GoogleSignIn")
   - jvm: /*nothing here yet, just stubs to fulfill the api*/

:common
   - commonMain: implement(":google-sso")
   - cocoapods: extract(":google-sso")

:iosApp (this is the iOS native codebase)
   - pod 'common' => '../common'
Surprisingly, that structure didn't work, I keep getting
ld: framework not found GoogleSignIn
. I even tried to add a
pod 'GoogleSignIn'
into the
iosApp
pods, but no luck. Am I missing something and it's not possible to have cocoapods pod in "not-main" KMM module (aka
common
in my case) ? P.S. Obviously, no issues on the android implementation, only on the iOS side
a

a-dd

11/14/2023, 2:55 PM
You need to add
pod("GoogleSignIn", linkOnly=true)
to
common
Sadly multi-module setup isn’t supported well at the moment
a

Andrii Yanechko

11/14/2023, 3:33 PM
Thanks! Now I keep getting
*Showing All Issues* > 'env pod install' command failed with an exception:
Copy code
Showing All Issues
   env: pod: No such file or directory
          Full command: env pod install

          Possible reason: CocoaPods is not installed

          Please check that CocoaPods v1.10 or above is installed.

          To check CocoaPods version type 'pod --version' in the terminal

          To install CocoaPods execute 'sudo gem install cocoapods'
However, when I run
pod install
from the terminal - it works (but the app still not building) P.S. my
pod --version
is
Copy code
1.14.2
c

Cas Van Luijtelaar

11/14/2023, 4:05 PM
Actually dealing with this exact same problem today. our kmm project is a separate package from our apps. we have a whole bunch of submodules which get bundled together in an umbrella module. unfortunately adding a linkedOnly in the umbrella still results in a “not found”
a

a-dd

11/14/2023, 4:06 PM
@Andrii Yanechko could you share a full build log? Preferably with
--stacktrace
or
--info
@Cas Van Luijtelaar the error can be caused by various reasons (for instance https://kotlinlang.org/docs/native-cocoapods.html#module-not-found). Could you file an issue (or start a separate thread) with more details?
👍 1
a

Andrii Yanechko

11/14/2023, 4:48 PM
Well, I usually build iOS application from the XCode and XCode during the building phase execute a Gradle tasks. After running a Gradle task directly from the terminal it surprisingly succeded, moreover, after trying to build the iOS application from XCode after that successful Gralde execution - it succeded as well 🤷‍♂️
blob thinking upside down 1
Thanks for helping, seems like
pod("GoogleSignIn", linkOnly=true)
helped me
👍 1
a

a-dd

11/14/2023, 4:53 PM
XCode during the building phase execute a Gradle tasks
JFYI you can pass additional flags to Gradle by editing script in the build phase
👍 1
2 Views