I've been struggling to solve a problem.
I'm building a cross platform app (iOS and Android) using Kotlin Multiplatform (KMP) where I need a library from Google (https://github.com/google/libphonenumber).
For Android, I can point to a Maven repo (https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.12.6/).
For iOS, I can use a ObjC port of libPhonenumber via Cocoapods.(https://cocoapods.org/pods/libPhoneNumber-ios).
But, I can't use Kotlin's (cocoapod plugin) to properly recognize the Pod. The plugin appears to fail to build. Here's the details of my setup:
- Xcode v11.5
- IntelliJ IDEA v2020.1.2
- Cocoapods v1.9.1
- Gradle 6.0.1
- Sample repo (https://github.com/touchlab/kotlin-native) NOTE: Within the repo, I'm using ./samples/cocoapods
- modify ./samples/cocoapods/kotlin-library/build.gradle.kts
commented out AFNetworking, remove AFNetworking pod
pod("AFNetworking", "~> 3.2.0")add a new podpod("libPhoneNumber-iOS") - modify ./samples/cocoapods/kotlin-library/gradle.properties
change this line:
kotlin.native.home=../../../distto this:#kotlin.native.home=../../../dist - in Terminal in this folder: ./samples/cocoapods/kotlin-library/
./gradlew podspecThis creates a podspec file (libPhoneNumber-iOS.def) in ./samples/cocoapods/kotlin-library/build/cocoapods/defs/ - cd from kotlin-library to ios-app folder
cd ../ios-app/ - Pod install using the command:
pod installYou'll see something like:
Downloading dependencies
Installing kotlin_library (1.0)
Installing libPhoneNumber-iOS (0.9.15)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
When I build the sample 'ios-app' target: simulator in Xcode, I get the error:
fatal error: module 'libPhoneNumber' not found
I have tried other libPhoneNumber pods, such as:
- libPhoneNumberSwift
- LTPhoneNumberField Both fail to build using Kotlin's cocoapods plugin, but work as a Pod without Kotlin's cocoapod plugin.
What am I missing?