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

michaelsims

05/08/2020, 5:41 PM
I'm attempting to build the cocoapods sample that is in https://github.com/JetBrains/kotlin-native/tree/master/samples/cocoapods but am running into issues. If I use the
build.sh
that is included, or if I follow the steps in
README.md
the result is the same. Attempting to build the shared Kotlin library fails during the gradle task
cinteropAFNetworkingIOS
:
Copy code
> Task :cinteropAFNetworkingIOS
e: /Users/me/AndroidStudioProjects/cocoapods/kotlin-library/build/classes/kotlin/iOS/main/kotlin-library-cinterop-AFNetworking.klib-build/kotlin/cocoapods/AFNetworking/AFNetworking.kt: (71, 23): Unresolved reference: UIAxis
e: /Users/me/AndroidStudioProjects/cocoapods/kotlin-library/build/classes/kotlin/iOS/main/kotlin-library-cinterop-AFNetworking.klib-build/kotlin/cocoapods/AFNetworking/AFNetworking.kt: (1988, 78): Unresolved reference: UIAxis
e: /Users/me/AndroidStudioProjects/cocoapods/kotlin-library/build/classes/kotlin/iOS/main/kotlin-library-cinterop-AFNetworking.klib-build/kotlin/cocoapods/AFNetworking/AFNetworking.kt: (2077, 70): Unresolved reference: UIAxis
I'm using CocoaPods 1.9.1, Java 1.8.0_77, Xcode 11.4.1 on OS X 10.15.4
a

Artyom Degtyarev [JB]

05/08/2020, 6:03 PM
m

michaelsims

05/08/2020, 6:04 PM
Excellent, thank you so much! I will give this a shot.
That worked, thanks again. For anyone else reading this, here is the exact change I made to the
build.gradle.kts
file in
kotlin-native/samples/cocoapods/kotlin-library
:
Copy code
diff --git a/samples/cocoapods/kotlin-library/build.gradle.kts b/samples/cocoapods/kotlin-library/build.gradle.kts
index 291c2faba..ecd80b1c8 100644
--- a/samples/cocoapods/kotlin-library/build.gradle.kts
+++ b/samples/cocoapods/kotlin-library/build.gradle.kts
@@ -7,6 +7,7 @@ repositories {
     jcenter()
     maven { setUrl("<https://dl.bintray.com/kotlin/kotlin-dev>") }
     maven { setUrl("<https://dl.bintray.com/kotlin/kotlin-eap>") }
+    maven { setUrl("<https://kotlin.bintray.com/native-xcode>") }
 }
 
 group = "org.jetbrains.kotlin.sample.native"
@@ -15,11 +16,14 @@ version = "1.0"
 kotlin {
     // Add a platform switching to have an IDE support.
     val buildForDevice = project.findProperty("kotlin.native.cocoapods.target") == "ios_arm"
+    val iOSMain by sourceSets.creating
+    iOSMain.dependencies {
+        implementation("org.jetbrains.kotlin.native.xcode:kotlin-native-xcode-11-4-workaround:1.3.72.0")
+    }
     if (buildForDevice) {
         iosArm64("iOS64")
         iosArm32("iOS32")
 
-        val iOSMain by sourceSets.creating
         sourceSets["iOS64Main"].dependsOn(iOSMain)
         sourceSets["iOS32Main"].dependsOn(iOSMain)
     } else {
👍 1
🎉 1
t

tylernol

07/09/2020, 5:01 PM
is this workaround still required for xcode 11.5 and kotlin 1.37.2? It appears so.
3 Views