https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
multiplatform
  • b

    Bailey Pollard

    08/19/2021, 10:10 AM
    Where should we store PNG assets to access them from kotlin native ios?
    w
    • 2
    • 1
  • p

    Peter Hsu

    08/19/2021, 8:42 PM
    I'm having some issues with AS recognizing my sources directory properly. My androidMain/java is showing up, but it's being shown as "commonMain" and duplicated as "commonTest"
    l
    • 2
    • 7
  • s

    smallshen

    08/20/2021, 9:32 AM
    are there an easy way to use stdlib functions in commonMain? such as forEach, String.toCharArray() etc
    k
    s
    • 3
    • 5
  • r

    rachael

    08/20/2021, 8:54 PM
    I'm trying to follow the tutorial here to compile an Apple Framework to use in an iOS project. I've successfully compiled Demo.framework but am having some trouble including it in an xcode project. I've added it under 'Frameworks, Libraries, and Embedded Content' and now see it in my file navigator under a Frameworks folder. I've also tried to add the path to my Framework Search Paths, but I'm getting a build error: directory not found for option, framework not found Demo I feel like I must be missing something. In case it matters, this is a brand new, empty iOS project.
    r
    • 2
    • 3
  • n

    Nikola Milovic

    08/21/2021, 7:16 PM
    Hey guys, what is causing this error?
    > Task :web-app:compileDevelopmentExecutableKotlinJs FAILED
    e: Module <dev.gitlive:firebase-auth> is a module[ModuleDescriptorImpl@62ac83c2] has reference public dev.gitlive.firebase.auth/FirebaseUser.displayName.<get-displayName>|-7122534302014937473[1], unfortunately neither itself nor its dependencies [
            org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsIrLinker$JsModuleDeserializer@5b30eb79
            org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsIrLinker$JsModuleDeserializer@17c9428e
            
    org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsIrLinker$JsModuleDeserializer@4974c
            org.jetbrains.kotlin.backend.common.serialization.IrModuleDeserializerWithBuiltIns@5d0478f0
    ] contain this declaration
    Please check that project configuration is correct and has required dependencies.
    The library in question ( I have it locally downloaded so I can probably edit it as needed). I've had similar errors but they were due to coroutines version mismatch, this seems like it's something else.
    a
    • 2
    • 1
  • s

    Slackbot

    08/23/2021, 7:35 AM
    This message was deleted.
    l
    n
    • 3
    • 2
  • a

    agta1991

    08/23/2021, 9:34 AM
    Did someone tried gradle includeBuild between a Kotlin Multiplatform multimodule project and a plain Android project? We have a Kotlin Multiplatform project with several modules and a single module which organizes our apps framework and I'm planing to expose this as an included build (with dependencySubstitution) to the plain old Android project, but after the substitution the dependency only sees the declarations from androidMain sourceSets and cant find the commonMain declarations.
    a
    • 2
    • 7
  • j

    Jonas Frid

    08/23/2021, 1:15 PM
    So I ran into this problem with running tests: https://youtrack.jetbrains.com/issue/KTIJ-8859 I can run a single test or all tests in a test class, but I can’t right click the test module and run all tests. Then I just get “No tasks available”. Is there some other way that I can run all tests?
    👀 1
    t
    j
    • 3
    • 2
  • m

    magnumrocha

    08/24/2021, 2:10 PM
    is anyone having this Issue on Multiplatform projects?
    > Task :shared:compileDebugAndroidTestKotlinAndroid
    e: /.../shared/src/commonTest/kotlin/<package>/Utils.kt: (5, 12): Expected function 'myExpectFunction' has no actual declaration in module <shared_debug> for JVM
    
    > Task :shared:compileDebugAndroidTestKotlinAndroid FAILED
    I am with the latest version of kotlin gradle plugin (1.5.21) and android gradle plugin (7.1.0-alpha09) I have no JVM targets setup on my kotlin plugin….
    k
    • 2
    • 5
  • s

    simon.vergauwen

    08/24/2021, 3:32 PM
    Hey 👋. Does anyone have an example/project they can share of Github Action caches some stuff for MPP? I saw it’s downloading a lot of binaries and platform specific things ever single time on CI.
    b
    l
    a
    • 4
    • 19
  • e

    Emiliano Schiavone

    08/24/2021, 8:39 PM
    Any idea why I do not see any iOS device?
    • 1
    • 1
  • m

    magnumrocha

    08/24/2021, 8:47 PM
    I am having Issue with:
    > Task :shared:compileDebugAndroidTestKotlinAndroid FAILED
    ...has no actual declaration in module <shared_debug> for JVM
    I have no
    jvm
    target set on the
    kotlin
    plugin, only
    android
    and
    ios
    targets, by the name of this task
    compileDebugAndroidTestKotlinAndroid
    what is it trying to do?
    j
    q
    • 3
    • 5
  • j

    jdoneill

    08/25/2021, 2:14 AM
    Updating multiplatform project with js/browser module resulting the error below, I had seen this in the past and don't recall the fix, I believe up/down grading kotlin but that is not working this time, any ideas?
    org.gradle.api.GradleException: Please initialize the Kotlin/JS target in 'web (:web)'. Use:
    kotlin {
        js {
            // To build distributions and run tests for browser or Node.js use one or both of:
            browser()
            nodejs()
        }
    }
    a
    h
    • 3
    • 4
  • s

    Sergei Popyvanov

    08/25/2021, 6:23 AM
    Hi 👋 How to implement equals method from shared code in swift? The problem is when shared code use operator “==” for 2 similar objects from swift it will return false. Shared:
    interface SharedInterface {
        val propertyA: Int
    }
    
    class SharedService() {
            fun equals(actual: SharedInterface, expected: SharedInterface){
                return actual.equals(expected)
            }
    }
    Swift:
    final class SharedInterfaceImpl: SharedInterface, Equatable {
       let propertyA: Int
        
    static func == (lhs: SharedInterfaceImpl, rhs: SharedInterfaceImpl) -> Bool {
            lhs.propertyA == rhs.propertyA 
        }
    }
    
    
    // some code in iOS main class
    
    let actual = SharedInterfaceImpl(1)
    let expected = SharedInterfaceImpl(1)
    
    print(actual == expected) // true
    print(SharedService().equals(actual, expected))  //false
    t
    • 2
    • 2
  • s

    Skolson5903

    08/25/2021, 9:26 AM
    Has anyone else seen really slow gradle syncs with 1.5.30? I have a fairly large size 4 module MP project and full syncs used to take about 5 minutes give or take. But now with 1.5.30 I'm seeing syncs take 25+ minutes! 99% of that 25+ minutes is spent in the :*runCommonizer* gradle task, and the task is using no CPU the entire time, like maybe its hanging on some network accesses or something. If anyone has suggestions I can try to diagnose this. I'd sure appreciate it :-)
    s
    r
    • 3
    • 9
  • m

    Matthias Geisler

    08/25/2021, 12:03 PM
    Hey lovely people - are Annotations for Android ProgradRules available for common code?
    b
    • 2
    • 2
  • j

    jean

    08/25/2021, 2:30 PM
    I have this function :
    override val isExecutable: (LoginViewState) -> Boolean = {
        it.isLoading &&
                it.email.value.isNotEmpty() &&
                it.password.value.isNotEmpty()
    }
    when I put a break point within the lambda and test
    it.email.value.isNotEmpty()
    I get the following error
    org.jetbrains.kotlin.codegen.CompilationException : Back-end (JVM) Internal error: Failed to generate expression: KtCallExpression
    File being compiled: (1,16) in /fragment.kt
    The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$Companion.getPackageMemberContainingClassesInfo(KotlinTypeMapper.kt:1402)
    If I replace
    it.email.value.isNotEmpty()
    by
    it.email.value.length > 0
    it works. What am I doing wrong here? PS : I get this error in my KMM project but I feel it’s more of a kotlin-wide issue. Now that
    general
    is read-only, where am I suppose to ask this kind of questions?
    a
    • 2
    • 3
  • s

    Sam

    08/25/2021, 6:45 PM
    I’m trying to build with the new iosSimulatorArm64 target and encountering resolution errors. Does that mean it can’t be done until dependencies are published for that platform or am I doing something wrong?
    No matching variant of org.jetbrains.kotlinx:kotlinx-serialization-core:1.2.2 was found. The consumer was configured to find a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
    👀 1
    a
    h
    +3
    • 6
    • 9
  • a

    Alan Keiss

    08/26/2021, 1:30 PM
    Hello, I have an iOS app that use a KMM library. Everything work fine with 
    iOS 14
     ✅ but with 
    iOS 15
     ❌ I am facing a 
    kotlin.native.IncorrectDereferenceException
     crash. Is there anyone who experienced the same issue?
    • 1
    • 1
  • e

    Emiliano Schiavone

    08/26/2021, 6:21 PM
    Im having an issue with KMM I just ran the wizard project then I tried to add Ktor and getting this errors. I have M1 and using Kotlin 1.5.30
    shared:compileKotlinIos FAILED 
    Could not resolve io.ktor:ktor-client-core:1.6.1.
    s
    l
    • 3
    • 9
  • b

    brabo-hi

    08/28/2021, 12:55 AM
    Hi all, i added a library in a shared project’s gradle file ,
    implementation("androidx.datastore:datastore-preferences-core:1.0.0")
    however i am not being able to get autocompletion with android studio, that doesn’t seem to recognize it
    c
    • 2
    • 1
  • b

    brabo-hi

    08/28/2021, 1:07 AM
    i cannot access it within
    commonMain
    but i can access it within
    androidMain
    a
    b
    • 3
    • 3
  • a

    atsushieno

    08/28/2021, 9:59 AM
    How can my app code access to the files added as
    src/commonMain/resources
    from native executable built as
    binaries.executable()
    ?
    👀 2
    b
    e
    o
    • 4
    • 19
  • e

    edwinRNDR

    08/28/2021, 5:04 PM
    Are there any examples of a multiplatform project in which a task generates .kt files that are placed in a separate sourceset? I run into problems with implicit dependencies and can't figure out how to go about this.
    k
    m
    • 3
    • 5
  • b

    Big Chungus

    08/29/2021, 12:21 AM
    Is there a definitive list of "testable" (i.e. where you can actually run tests) kotlin targets?
    c
    • 2
    • 2
  • w

    William Persall

    08/29/2021, 2:01 AM
    I created a full-stack web multiplatform project from the template. When I run the run task, I get
    Execution failed for task ':run'.
    > Process 'command 'C:\Users\folder\.jdks\liberica-1.8.0_302\bin\java.exe'' finished with non-zero exit value 1
    not sure how to diagnose what the cause it, would someone be able to assist?
    a
    • 2
    • 3
  • v

    Viktor Petrovski

    08/29/2021, 7:02 AM
    Hello 👋 I’m starting to work on a project that I tend to do it using KotlinMultiPlatform. can you guys recommend some open source/article explaining code organisation and architecture on kmm projects, would love to see some examples.
    a
    • 2
    • 4
  • s

    simon.vergauwen

    08/31/2021, 11:26 AM
    Hey everyone 👋, I was wondering if anyone has attempted to leverage the new “Shared Indexes” functionality to share indexes of multiplatform dependencies. I notice that after adding JS (Browser/Node), and all native targets to my project that indexing exploded. It seems that if installed correctly “Shared Indexes” might be able to almost completely get rid of the indexing of all common libraries. References: https://blog.jetbrains.com/idea/2020/07/shared-indexes-plugin-unveiled/ https://docs.google.com/document/d/1Lvhyimh94Ni-VqKYMktknsB8Itv3pYkYRy0QUsUPn4o/edit
    j
    • 2
    • 13
  • m

    Mihail Krivov

    08/31/2021, 4:40 PM
    Sup every1🖖 Case: M1 processor Multiplatform project with last changes from documentation ( migration to embedAndSignAppleFrameworkForXcode ) + last version of kotlin (1.5.30-release-411) Any type of ios config in gradle e.g.:
    val ios = listOf(iosX64(), iosArm64())
    configure(ios) {
    binaries{
    framework{
    baseName = "commonModule"
    }
    }
    }
    ...
    ...
    val iosX64Main by getting{
    dependencies{
    ...kotlinx-coroutines-core-native:1.3.5
    ...ktor-client-ios:1.6.1
    ...sqldelight:native-driver:1.5.0
    }
    val iosArm64Main by getting{
    dependsOn(iosX64Main)
    }
    OR
    ios {
    binaries{
    framework{
    baseName = "commonModule"
    }
    }
    }
    val iosMain by getting{
    dependencies{
    ...kotlinx-coroutines-core-native:1.3.5
    ...ktor-client-ios:1.6.1
    ...sqldelight:native-driver:1.5.0
    }
    OR any structure u prefer And regardless of type u prefer, xCode everytime return error when try to build project like task embedAndSignAppleFrameworkForXcode not found OR NVActivityIndicatorView not found for target x86_64-apple-ios-simulator OR one time I saw error like DatabaseDriverFactory has no dependencies OR Execution failed for task ":commonModule:compileKotlinIosX64" OR etc... So... can any1 explain me what I need to do?! I feel like a blind kitten and constantly bump into walls 🤕
    :thread-please: 2
    s
    • 2
    • 3
  • c

    Carson Holzheimer

    09/01/2021, 5:53 AM
    I upgraded to kotlin 1.5.30 and tried to use the new cocoapods plugin features to get around this: https://youtrack.jetbrains.com/issue/KT-42023#focus=Comments-27-4880877.0-0 However now the xcode build just fails with this error:
    * What went wrong:
    Task 'Debug' not found in root project 'KotlinCommon'.`
    Why is it looking for a task called Debug???
    l
    v
    • 3
    • 30
Powered by Linen
Title
c

Carson Holzheimer

09/01/2021, 5:53 AM
I upgraded to kotlin 1.5.30 and tried to use the new cocoapods plugin features to get around this: https://youtrack.jetbrains.com/issue/KT-42023#focus=Comments-27-4880877.0-0 However now the xcode build just fails with this error:
* What went wrong:
Task 'Debug' not found in root project 'KotlinCommon'.`
Why is it looking for a task called Debug???
l

Luis

09/01/2021, 6:20 AM
Show us the XCode configurations you have
Kotlin only works with “DEBUG” and “RELEASE” configurations, so if you have other XCode configurations, the script will pass ``-Pkotlin.native.cocoapods.configuration=$CONFIGURATION` with an unsupported string
It is complaining about a
Debug
configuration, so maybe try changing it to
DEBUG
all caps
c

Carson Holzheimer

09/01/2021, 7:50 AM
I have a lot of different Xcode configurations but isn't that what this new feature is supposed to handle?
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
I have mapped all the configurations. Even "Debug" by itself, tho it is not one of my configs
v

Viacheslav Kormushkin

09/01/2021, 8:12 PM
Hi Carson, could you please share more details such as cocoapods block from build script and xcode configuration name you were building when got this error?
l

Luis

09/01/2021, 11:15 PM
@Carson Holzheimer this new feature makes it so you don’t need to have a custom “packForXcode” task in your gradle file, and it helps with some syncing bugs. It still only handles two types of configurations from Xcode, RELEASE and DEBUG. So your Build Phase Run Script needs to map the configurations in Xcode to one of those two strings. If you are using cocoapods, the place to do this would be to specify
noPodspec()
in your shared mmp build.gradle, then edit the podspec file script to do the string manipulation there
c

Carson Holzheimer

09/02/2021, 4:18 AM
@Luis so that Youtrack issue shouldn’t be marked as fixed? I’ll share my code…
xcode configs and cocoapods block:
cocoapods {
        // Configure fields required by CocoaPods.
        summary = "Shared Kotlin code across iOS and Android"
        homepage = "redacted"
        ios.deploymentTarget = "12.0"
        podfile = project.file("../Podfile")
        framework {
            baseName = "KotlinCommon"
            isStatic = true
        }

        val apps = listOf("DMS", "WFM")
        val schemes = listOf("Prod", "Beta", "Labs", "QA")
        val listOfDebugConfigs = apps.flatMap { app ->
            schemes.map { scheme ->
                "$app Debug ($scheme)"
            }
        }
        val listOfReleaseConfigs = apps.flatMap { app ->
            schemes.map { scheme ->
                "$app Release ($scheme)"
            }
        }

        // Not sure why these are required but build fails without it
        xcodeConfigurationToNativeBuildType["WFM"] = org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG
        xcodeConfigurationToNativeBuildType["DMS"] = org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG
        xcodeConfigurationToNativeBuildType["Debug"] = org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG

        listOfDebugConfigs.forEach {
            xcodeConfigurationToNativeBuildType[it] = org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEBUG
        }

        listOfReleaseConfigs.forEach {
            xcodeConfigurationToNativeBuildType[it] = org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.RELEASE
        }
    }
l

Luis

09/02/2021, 4:26 AM
Sorry @Carson Holzheimer, I actually misread your post. I checked the code changes on the issue you linked and it should work like you are saying
Could you provide more logs on the gradle task failing? Xcode should show more details. Why is it trying to find a task called “Debug”, right?
Ah maybe I got it
😮 1
You need to escape the spaces
c

Carson Holzheimer

09/02/2021, 4:28 AM
haha I was actually going to try that but thought no that can’t be it
I’ll try
l

Luis

09/02/2021, 4:28 AM
I don’t understand exactly what these bits do
val listOfDebugConfigs = apps.flatMap { app ->
            schemes.map { scheme ->
                "$app Debug ($scheme)"
            }
        }
        val listOfReleaseConfigs = apps.flatMap { app ->
            schemes.map { scheme ->
                "$app Release ($scheme)"
            }
        }
Could you paste the generate podspec? Maybe we could figure out if the spaces are an issue by looking at it
👍 1
c

Carson Holzheimer

09/02/2021, 4:42 AM
Pod::Spec.new do |spec|
    spec.name                     = 'KotlinCommon'
    spec.version                  = '1.0'
    spec.homepage                 = 'redacted'
    spec.source                   = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
    spec.authors                  = ''
    spec.license                  = ''
    spec.summary                  = 'Shared Kotlin code across iOS and Android'

    spec.vendored_frameworks      = "build/cocoapods/framework/KotlinCommon.framework"
    spec.libraries                = "c++"
    spec.module_name              = "#{spec.name}_umbrella"

    spec.ios.deployment_target = '12.0'

                

    spec.pod_target_xcconfig = {
        'KOTLIN_PROJECT_PATH' => ':',
        'PRODUCT_MODULE_NAME' => 'KotlinCommon',
    }

    spec.script_phases = [
        {
            :name => 'Build KotlinCommon',
            :execution_position => :before_compile,
            :shell_path => '/bin/sh',
            :script => <<-SCRIPT
                if [ "YES" = "$COCOAPODS_SKIP_KOTLIN_BUILD" ]; then
                  echo "Skipping Gradle build task invocation due to COCOAPODS_SKIP_KOTLIN_BUILD environment variable set to \"YES\""
                  exit 0
                fi
                set -ev
                REPO_ROOT="$PODS_TARGET_SRCROOT"
                "$REPO_ROOT/gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
                    -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
                    -Pkotlin.native.cocoapods.archs="$ARCHS" \
                    -Pkotlin.native.cocoapods.configuration=$CONFIGURATION \
                    -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS" \
                    -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS" \
                    -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
            SCRIPT
        }
    ]
end
It does look like escaping spaces is the problem:
/bin/sh -c /Users/carsonholzheimer/Library/Developer/Xcode/DerivedData/RedEye-bnxkyzimuyxvsiczcehnvfezhktc/Build/Intermediates.noindex/Pods.build/WFM\\\ Debug\\\ \\\(QA\\\)-iphonesimulator/KotlinCommon.build/Script-B9E7066122875376ACF9D124F6326B2D.sh

                REPO_ROOT="$PODS_TARGET_SRCROOT"
                "$REPO_ROOT/gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework                     -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME                     -Pkotlin.native.cocoapods.archs="$ARCHS"                     -Pkotlin.native.cocoapods.configuration=$CONFIGURATION                     -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS"                     -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS"                     -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"

> Configure project :
Kotlin Multiplatform Projects are an Alpha feature. See: <https://kotlinlang.org/docs/reference/evolution/components-stability.html>. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.

Unable to detect Kotlin framework build type for CONFIGURATION=WFM Debug (QA) automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=WFM Debug (QA) automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=WFM Debug (QA) automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=WFM Debug (QA) automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'

FAILURE: Build failed with an exception.

* What went wrong:
Task 'Debug' not found in root project 'KotlinCommon'.
It’s seeing Debug as a gradle task for some reason. How would I fix that (preferably not changing xcode configs..
I assume that script is generated by the cocoapods plugin, is it time for a new Youtrack issue?
The previous logs that build succesfully:
/bin/sh -c /Users/carsonholzheimer/Library/Developer/Xcode/DerivedData/RedEye-ediatwizneiykycbhcshsflepmrj/Build/Intermediates.noindex/Pods.build/WFM\\\ Debug\\\ \\\(QA\\\)-iphonesimulator/KotlinCommon.build/Script-76194415D0376B6F6C5FC66A6A58DEE6.sh


                APP_BUILD="$CONFIGURATION"
                if [[ APP_BUILD == *"Debug"* ]]
                then
                    APP_BUILD="DEBUG"
                else
                    APP_BUILD="RELEASE"
                fi
                REPO_ROOT="$PODS_TARGET_SRCROOT"
                "$REPO_ROOT/gradlew" -p "$REPO_ROOT" ::syncFramework                     -Pkotlin.native.cocoapods.target=$KOTLIN_TARGET                     -Pkotlin.native.cocoapods.configuration=$APP_BUILD                     -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS"                     -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS"                     -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"

> Configure project :
Kotlin Multiplatform Projects are an Alpha feature. See: <https://kotlinlang.org/docs/reference/evolution/components-stability.html>. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.

Unable to detect Kotlin framework build type for CONFIGURATION=WFM Debug (QA) automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=WFM Debug (QA) automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=WFM Debug (QA) automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'
Unable to detect Kotlin framework build type for CONFIGURATION=WFM Debug (QA) automatically. Specify 'KOTLIN_FRAMEWORK_BUILD_TYPE' to 'debug' or 'release'

The Kotlin source set androidAndroidTestRelease was configured but not added to any Kotlin compilation. You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets>

> Task :compileKotlinIosX64
> Task :linkReleaseFrameworkIosX64
> Task :syncFramework

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See <https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings>

BUILD SUCCESSFUL in 29s
l

Luis

09/02/2021, 7:03 AM
Sorry @Carson Holzheimer I think in your case when you have
"$app Debug ($scheme)"
in your build.gradle, you should try to do something like
"$app\\ Debug\\ ($scheme)"
or maybe
"\"$app Debug ($scheme)\""
Either that or in your podspec add quotes to your
$CONFIGURATION
variable in the script
c

Carson Holzheimer

09/02/2021, 7:04 AM
I’ve tried 1,2,3 and 4 slashes 🤣 But I will try your last suggestion.
l

Luis

09/02/2021, 7:05 AM
basically, when the script is running, it replaces
$CONFIGURATION
with
WFM Debug (QA)
but because it has spaces it breaks the script
❤️ 1
gradle stops reading by
WFM
and then it tries to run the “task”
Debug
because of the spaces
👍 1
Either you do that, or you change your configurations in Xcode to not have spaces, maybe underscores 😛
👍 1
c

Carson Holzheimer

09/02/2021, 7:07 AM
Gotta try not upset the iOS devs, you know 😄
😅 1
l

Luis

09/02/2021, 7:10 AM
let me know if you get it working!
c

Carson Holzheimer

09/03/2021, 3:02 AM
I didn’t manage to get it working. I’ll leave the
noPodspec
workaround in for the moment and make a Youtrack issue
👍 1
View count: 15