Im trying to setup cocoapods in kmp project on android studio in separate cocoapods.gradle.kts file to be able to exclude it if platform is windows and run it if its mac.
In my build.gradle.kts:
if (System.getProperty("os.name").contains("Mac")) {
apply(from = "cocoapods.gradle.kts")
}
I need to build this with mac:
//cocoapods.gradle.kts file
cocoapods {
summary = "Project Up"
homepage = "https://github.com/yourproject"
version = "1.0"
ios.deploymentTarget = "14.1"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "Up"
isStatic = true
}
pod("FirebaseAnalytics")
pod("FirebaseCrashlytics")
}
With this cocoapods is unresolved on Mac and ai suggests me to add import and some setup with org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension or to include kotlin block
all of which is unresolved as well.
Tried applying:
kotlin("multiplatform") version "2.2.0"
as plugin in settings.gradle.kts with no success.
cocoapods.gradle.kts is in same folder as my build.gradle.kts file.
Broader questions would be how to add dependencies in separate gradle file or how to collaborate on kmp project on both windows and mac.
I also tried this: convention plugins
Please help.
minimal working example of how the cocoapods.gradle.kts should look. But the key is that you need to configure the kotlin block from here
// cocoapods.gradle.kts
configure<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension> {
cocoapods {
summary = "Project Up"
homepage = "https://github.com/yourproject"
version = "1.0"
ios.deploymentTarget = "14.1"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "Up"
isStatic = true
}
pod("FirebaseAnalytics")
pod("FirebaseCrashlytics")
}
}