https://kotlinlang.org logo
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
  • p

    Phil Saul

    12/03/2021, 8:57 AM
    Hi everyone! I've got to add localization to a kotlin multiplatform project and was wondering if anyone has some recommendations for a library that could help? I've had a look at moko resources, but unfortunately I need something that targets iOS, Android and JavaScript
    j
    a
    • 3
    • 2
  • n

    Nicolas Picon

    12/03/2021, 10:34 AM
    Hi all! I am using Kotlin All-Open compiler plugin to be able to use Fakes for testing. It works fine on Android but fails for iOS with error like
    AuthenticationClientFake.kt: (26, 43): This type is final, so it cannot be inherited from
    Is there some plan to support this compiler plugin with Kotlin Native?
    n
    • 2
    • 2
  • s

    Siggi Gunnarss

    12/03/2021, 2:32 PM
    Hi! We are now using kotlin multiplatform in production in our main app, both Android and iOS. I wrote about it here: https://www.festinasweden.se/kotlin-multiplatform/ Since this community has helped me from the beginning I figured i would share here. AMA
    👍 8
    :thumbsup_all: 2
    🙏 1
    k
    • 2
    • 2
  • k

    kpgalligan

    12/03/2021, 4:05 PM
    I would guess when you do your migration you aren't incrementing the version. See here: https://github.com/touchlab/SQLiter/blob/main/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/DatabaseConnection.kt#L80
    a
    • 2
    • 11
  • k

    kpgalligan

    12/03/2021, 4:06 PM
    So, you need to grab the version from the old db and set it manually in the new db, then you'd avoid the migration on sqldelight start. I'm making the assumption that sqldelight is trying to create a table that already exists from your migration process (correct?)
    j
    a
    • 3
    • 3
  • k

    kpgalligan

    12/03/2021, 4:11 PM
    What version of sqldelight are you on? Looks a bit old. SQLiter config is kind of different now, and there's direct support for adding sqlcipher keys
    a
    • 2
    • 1
  • a

    Anamika Trivedi

    12/03/2021, 7:46 PM
    Hello! Is SQLDelight a recommended library to be used for caching in KMM project? Can Realm instead be used? Are there any examples where Realm has been used successfully and is better than SQLDelight?
    m
    m
    +3
    • 6
    • 8
  • d

    dwursteisen

    12/04/2021, 10:00 AM
    👋 I built a multiplatform library that expose some alias or extension methods. (For example:
    typealias Seconds = Float
    . The library is built for Android/JVM/JS. When I’m using this library in an android application, I can’t import my alias. I checked in the
    aar
    file: the typealias is present. Also, using my lib in a jvm or js project. the
    Seconds
    alias can be imported. I don’t understand why I can’t import it while I don’t have any issue with other class for my library. Did you already get this issue?
    • 1
    • 1
  • r

    Rahul Rawat

    12/05/2021, 8:01 AM
    I’ve been working on a kotlin multiplatform library for a while now and I started using  kermit logger for it. Everything builds well the only concern I have are the following warnings I am getting
    Unable to resolve dependency for ':@debug/compileClasspath': Could not resolve co.touchlab:kermit:1.0.2.
    Show Details
    Affected Modules: AddressLibrary
    
    Unable to resolve dependency for ':@debugUnitTest/compileClasspath': Could not resolve co.touchlab:kermit:1.0.2.
    Show Details
    Affected Modules: AddressLibrary
    
    Unable to resolve dependency for ':@debugAndroidTest/compileClasspath': Could not resolve co.touchlab:kermit:1.0.2.
    Show Details
    Affected Modules: AddressLibrary
    Can anyone help me with any way on how to make them go away or why they are coming?
    r
    • 2
    • 2
  • j

    John O'Reilly

    12/05/2021, 9:41 AM
    Am trying out new AWS SDK for Kotlin (https://aws.amazon.com/sdk-for-kotlin/) in shared KMP code and running in issue that following (in AWS SDK code) is returning true when running JVM code (located in
    jvmMain
    )...anybody know why that would be the case (the KMP module in this case targets just android and JVM) ?
    private static boolean isAndroid() {
            try {
                Class.forName("android.os.Build");
                return true;
            } catch (ClassNotFoundException ex) {
                return false;
            }
        }
    d
    • 2
    • 7
  • o

    oshai

    12/05/2021, 3:22 PM
    avoid duplicate publication: I am trying to deploy MP project to maven central and added the explained here: https://kotlinlang.org/docs/mpp-publish-lib.html#avoid-duplicate-publications but still seeing same artifacts on different host. Any working example?
    m
    • 2
    • 8
  • l

    Luc Girardin

    12/05/2021, 5:02 PM
    Did one of you had more success at using Kotlin multiplatform with Gradle project import or composite build? https://youtrack.jetbrains.com/issue/KT-50064
    r
    u
    • 3
    • 3
  • a

    Amin Bahiraei

    12/06/2021, 5:36 AM
    Hi Guys, How to use sealed class in Flow in swift, KMM compiles it strange way
    n
    • 2
    • 1
  • p

    Pavel Repkin

    12/06/2021, 10:57 AM
    Hi! When iOS framework is distributed with “CocoaPods dependency manager” and a crash is happening in Kotlin code, the stack trace is missing the location of the crash in the source code (line number, character number) On the other hand, when building KMM app as a regular framework, this info is printed Example
    (/Users/par/code/my/github/kmm_cocoa/MyApplicationwithframework/shared/src/iosMain/kotlin/com/example/myapplicationwithframework/Platform.kt:10:15)
    at 5   shared                              0x000000010b99e05d kfun:com.example.myapplicationwithframework.Platform#<init>(){} + 1181 (/Users/par/code/my/github/kmm_cocoa/MyApplicationwithframework/shared/src/iosMain/kotlin/com/example/myapplicationwithframework/Platform.kt:6:35)
    at 6   shared                              0x000000010b99dacd kfun:com.example.myapplicationwithframework.Greeting#greeting(){}kotlin.String + 413 (/Users/par/code/my/github/kmm_cocoa/MyApplicationwithframework/shared/src/commonMain/kotlin/com/example/myapplicationwithframework/Greeting.kt:5:26)
    I know that debug information is located inside .dsym files, but I have no idea how to fix the issue. Doesn’t CocopoaPods distribution support crash debugging yet? EDIT Stack trace from a CocoaPods distributed app
    Uncaught Kotlin exception: kotlin.IllegalStateException: fruit expired
    at 0   iosApp                              0x00000001013e9131 kfun:kotlin.Throwable#<init>(kotlin.String?){} + 97
    at 1   iosApp                              0x00000001013e397d kfun:kotlin.Exception#<init>(kotlin.String?){} + 93
    at 2   iosApp                              0x00000001013e3a7d kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 93
    at 3   iosApp                              0x00000001013e3dad kfun:kotlin.IllegalStateException#<init>(kotlin.String?){} + 93
    at 4   iosApp                              0x00000001013d8302 kfun:com.example.myapplication.Platform#fruit(){}kotlin.String + 146
    at 5   iosApp                              0x00000001013d7f53 kfun:com.example.myapplication.Platform#<init>(){} + 1587
    k
    • 2
    • 2
  • e

    Ernestas

    12/06/2021, 12:01 PM
    Hi, are there any guides or examples, how to model relationships between sql tables and map them into data classes with sqlDelight? Something similar to Room’s @Relation
    r
    h
    k
    • 4
    • 4
  • o

    Osman Saral

    12/07/2021, 1:08 PM
    Hello, Before kotlin 1.6.0 I was able to map my sealed classes to swift enums:
    enum ResponseStateEnum<T: AnyObject> {
        case loading
        case success(T)
        case error(RestClientException)
        
        init(_ state: ResponseState<T>?) {
            if state is ResponseStateLoading {
                self = .loading
            } else if let state = state as? ResponseStateSuccess<T>, let content = state.content {
                self = .success(content)
            } else if let state = state as? ResponseStateError {
                self = .error(state.exception)
            } else {
                fatalError("ResponseStateEnum not syncronized with ResponseState class")
            }
        }
    }
    now I get this log
    (lldb) po type(of: state!)
    PKMMResponseStateLoading
    
    (lldb) po state is PKMMResponseStateLoading
    false
    Did anything change about sealed classes?
    • 1
    • 1
  • t

    tylerwilson

    12/07/2021, 3:48 PM
    How about an up-to-date web page with a table of Kotlin versions and matching first-party libs? It is unfortunate there is such a delay for all the libs…
    r
    c
    • 3
    • 4
  • j

    Jemo

    12/07/2021, 4:14 PM
    Hello, I was thinking what will be the best approach to configure API base urls for different
    buildTypes
    in KMM project? In a plain android project (without KMM) I could have a different base urls written inside app
    build.gradle
    and then I can access that values from code for ex:
    BuildConfig.BaseUrl
    so how to achieve similar behaviour for KMM shared module? as I know I can't access buildConfig from that module.
    m
    • 2
    • 3
  • i

    Igor Milakovic

    12/07/2021, 5:24 PM
    Hey there! I haven't found many results on setting up Fastlane with KMM - are you guys using Fastlane at all? And if so, do you set it up in the root of the project (so one Fastfile etc for both iOS and Android), or do you set it up separately in
    iosApp
    and
    androidApp
    folders? Thanks!
    n
    • 2
    • 4
  • u

    ursus

    12/08/2021, 6:08 AM
    Do I need a mac to build a native target used by ios? (I dont need to run it, just build) Asking for a CI/CD friend, if my linux box will be enough or does ci now need to run on some macbook mini
    b
    k
    • 3
    • 3
  • e

    eygraber

    12/08/2021, 6:45 PM
    Is there a known issue where common code doesn't resolve in Android Studio? I have a jvm module that depends on a multiplatform module with common code. All of the common code is red and marked as an "Unresolved reference". The project builds and it works fine in Intellij, so it looks like it's just Android Studio that has a problem. Using Android Studio Bumblebee Beta 4
    m
    s
    • 3
    • 3
  • n

    nschulzke

    12/08/2021, 11:49 PM
    Does anyone have a solution to this problem? I've seen multiple people ask but no response from anyone. I get this error when trying to build from XCode:
    Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'.
    I'm running
    ./gradlew :shared:embedAndSignAppleFrameworkForXcode
    from XCode 13.1 on an M1 mac. When I'm on Kotlin 1.5.21, it finds the task and fails because 1.5.21 isn't compatible with Apple Silicon. When I upgrade to Kotlin 1.5.31, I get the above error. I've double-checked in the log, and all the required environment variables are set by XCode before
    ./gradlew
    is called.
    a
    j
    • 3
    • 11
  • h

    hsyogesh

    12/09/2021, 7:13 AM
    Can anyone recommend me what I might have done wrong publishing aar to Jfrog not adding dependencies used in shared project to pom file
    kotlin {
    
        android {
            publishLibraryVariants("release","debug")
    
            publishing {
    
                publications {
                    create<MavenPublication>("aar") {
                        version = "1.0.6"
                        groupId = "Mobile-Shared"
                        artifactId = "shared"
                        artifact("$buildDir/outputs/aar/${project.name}-release.aar")
                    }
                }
            }
    
        }
        iosX64()
        iosArm64()
    
        artifactory {
            clientConfig.isIncludeEnvVars = true
            setContextUrl("<https://amaas-eos-mw1.cec.lab.emc.com/artifactory/UnityCloud_Generic/android>")
    
            publish(delegateClosureOf<PublisherConfig> {
                repository(delegateClosureOf<DoubleDelegateWrapper> {
                    setProperty("repoKey", "CloudIQ-Mobile-Shared")
                    setProperty("username", "${articatofryUserName}")
                    setProperty("password", "${articatofryPassword}")
                    setProperty("maven", true)
                })
                defaults(delegateClosureOf<groovy.lang.GroovyObject> {
                    invokeMethod("publications", "aar")
                    setPublishPom(true)
                    setProperty("publishArtifacts", true)
                    setProperty("publishPom", true)
                })
            })
        }
    b
    o
    • 3
    • 2
  • s

    sendoav

    12/09/2021, 2:29 PM
    Hi all! I have an umbrella framework containing 6 kotlin modules. Even the smallest change in one module provokes the linkPodDebugFrameworkIos64 to take more than 4 minutes, is it normal? I have already checked some tips to improve native compilation time but I'm not able to lower from 4 minutes. I'm using kotlin 1.5.30
    k
    m
    • 3
    • 12
  • c

    Carson Holzheimer

    12/09/2021, 2:55 PM
    How can I ask gradle to run another task when using the cocoapods plugin. I've tried numerous things like
    dependsOn("syncFramework"), dependsOn("build")
    but whenever I build, it doesn't run the task.
    😒olved: 1
    • 1
    • 2
  • r

    rsetkus

    12/09/2021, 4:13 PM
    Hi. Trying to build iOS fat framework on Kotlin Multiplatform but it is failing with error:
    * What went wrong:
    Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
    Gradle properties:
    org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
    org.gradle.jvmargs=-Xmx6G
    org.gradle.daemon=true
    org.gradle.parallel=true
    Gradle deamon gets killed/disappears at 2g - 3g memory usage. Task to build fat framework:
    tasks.register<FatFrameworkTask>("releaseFatFramework") {
        baseName = "MyKMM"
        destinationDir = buildDir.resolve("fat-framework/release")
        from(
            iosArm64().binaries.getFramework("RELEASE"),
            iosX64().binaries.getFramework("RELEASE")
        )
    }
    Environment: Java 8, 11 and 17, Kotlin 1.4.32, Gradle 6.5.1, macOS Big Sur Any ideas what is wrong? It used to build fine.
    i
    • 2
    • 9
  • a

    Anamika Trivedi

    12/09/2021, 5:49 PM
    Can anyone recommend any logging library that can be used to log info inside Ktor code?
    c
    k
    • 3
    • 3
  • b

    Bart Whiteley

    12/09/2021, 6:46 PM
    When building with
    kotlin-gradle-plugin:1.6.0
    my iOS framework doesn’t have bitcode, but
    kotlin-gradle-plugin:1.5.31
    works. What am I doing wrong? I have this:
    ios {
            binaries {
                framework {
                    baseName = "kmmsharedmodule"
                    embedBitcode("bitcode")
                    xcf.add(this)
                }
            }
        }
    w
    • 2
    • 3
  • j

    Jeff Tycz

    12/09/2021, 9:11 PM
    I have an existing multiplatform mobile app and I want to start rewriting it using jetpack compose for Android. When I add all the dependencies to use compose as described in the jetpack setup documentation for Android I get errors when I build saying
    couldnt find inline method ColumnKt;.Column
    and all I have is just a column added. Can you not create an Android app in compose in a KMM app? I can create a new compose app and it works just fine
    m
    • 2
    • 2
  • i

    Igor Milakovic

    12/09/2021, 11:23 PM
    Can someone point me in the right direction in regards to Crashlytics integration. I'm trying to wrap my head around the fact that a crash can occur in 5 different places:
    androidApp
    ,
    iosApp
    ,
    commonMain
    ,
    androidMain
    and
    iosMain
    . How/where do you implement Crashlytics to capture crash reports in any scenario? Thanks!
    g
    k
    c
    • 4
    • 35
Powered by Linen
Title
i

Igor Milakovic

12/09/2021, 11:23 PM
Can someone point me in the right direction in regards to Crashlytics integration. I'm trying to wrap my head around the fact that a crash can occur in 5 different places:
androidApp
,
iosApp
,
commonMain
,
androidMain
and
iosMain
. How/where do you implement Crashlytics to capture crash reports in any scenario? Thanks!
g

Grégory Lureau

12/09/2021, 11:38 PM
Kermit 1.0 has just been released, more than logs, it's also handling crashlytics for KMP.
:thank-you: 1
k

kpgalligan

12/10/2021, 1:17 PM
I had planned a follow up blog post on crash reporting. Guess I'll bump that up in the queue.
:thank-you: 1
i

Igor Milakovic

12/10/2021, 4:17 PM
Thanks guys! Would you say Kermit is the best available practice for crash reporting for KMM?
k

kpgalligan

12/10/2021, 4:19 PM
Well, as always, it depends. I'll try to do a quick version of what a longer explanation would be...
i

Igor Milakovic

12/10/2021, 4:21 PM
Much appreciated Kevin! Some guy on stackoverflow suggests this: https://stackoverflow.com/a/67186079/1104337 It sounds too simple and I'm not sure it would capture crashes from androidMain, commonMain and iosMain?
k

kpgalligan

12/10/2021, 4:22 PM
For the first issue, the different source sets and platforms, when the ide looks at the different folders, common and the various targets are kind of "different", but when the compiler puts them together, it's all just "source". So, when the Kotlin/Native compiler is building the ios framework,
commonMain
and
iosMain
are the only thing it cares about. For Android,
commonMain
and
androidMain
(and I guess
androidApp
) are all that it cares about. It's kind of hard to describe what I mean there, but from the compiler and runtime's perspective,
commonMain
is just more platform-specific Kotlin (that just happens to have nothing platform specific in it).
For Android, you can just add crashlytics as you would normally, and it'll capture crashes as you would expect. Nothing special needed. For breadcrumbs, you need a way to write them out that will also be accessible from
commonMain
. The way we do that (with Kermit) is there's a "common" LogWriter that will write to Android's Crashlytics on Android. You could do that on your own by simply defining an interface and passing in an implementation on start, but that's what the Kermit LogWriter exists to do.
iOS is more complicated...
That stack overflow answer sucks. No offense to whoever wrote it. I'll need to go add an answer once the blog posts is written. Anyway...
You can also just set up Crashlytics on iOS as you normally would, and you'll get crashes. You can also add breadcrumbs as described by way of an interface in common code that will be implemented from Swift/Objc. However...
If a crash happens in Kotlin code, you will get a useless crash. The stack trace only goes to the point where your Swift/Objc code called into Kotlin code, but you get no info on the Kotlin stack trace.
That's the real trick.
We had https://github.com/touchlab/CrashKiOS/ before the Kermit stuff, and we'll be expanding it a bit (will describe in a bit).
i

Igor Milakovic

12/10/2021, 4:28 PM
I see, that's what I was worried about.
So Kermit solves that problem?
k

kpgalligan

12/10/2021, 4:29 PM
Read the README for CrashKiOS. On Kermit, I'm getting there...
i

Igor Milakovic

12/10/2021, 4:29 PM
Will do, thank you so much for all this information!
k

kpgalligan

12/10/2021, 4:31 PM
Kermit does a pretty good job of simplifying this situation. Better than CrashKiOS on it's own, which requires you write the Swift/Objc implementation. However, when designing that Kermit integration, I was focused on static frameworks, which is the majority of what we build for a number of reasons. Kermit's Crashlytics integration works with static frameworks only. If you aren't using a static framework, you'll need something a bit more complicated.
This isn't a Kermit thing, it's more of an iOS/Framework thing.
i

Igor Milakovic

12/10/2021, 4:32 PM
I'm using CocoaPods for the shared module
k

kpgalligan

12/10/2021, 4:32 PM
Basically, firebase says you shouldn't link the Crashlytics framework inside of your dynamic framework: https://github.com/firebase/firebase-ios-sdk/blob/master/docs/firebase_in_libraries.md
You can use cocoapods, but
isStatic
needs to be true
cocoapods {
        framework {
            isStatic = true
        }
    }
If it's dynamic, the way to handle it would be to write your own Kermit LogWriter for iOS and pass it in. Not complicated, but we really need to document that.
We reference that in the docs, but we need a better overall explanation https://github.com/touchlab/Kermit/tree/main/kermit-crashlytics#dynamic-frameworks
It would be (somewhat) more clear if we had a gradle plugin and we could fail the build if the framework is dynamic, but short of that, we'll just need better docs 🙂
i

Igor Milakovic

12/10/2021, 4:37 PM
Oh right, yes, I should be able to add that. Thanks again for your time! I'll start exploring Kermit and come back with specific questions if I have any. Just a quick question for verifying the implementation - I was thinking about placing 3 buttons in iOS and Android apps, and they would cause a crash in iosApp, iosMain and commonMain, and then on Android in androidApp, androidMain and commonMain. If I see all the crashes symbolicated in Crashlytics dashboard, I guess that means the implementation is fully working?
k

kpgalligan

12/10/2021, 4:44 PM
Yes, although read how the logs come in. When a crash is caught by the Kotlin handler, it sends a "handled exception" with the Kotlin stack, and then the iOS Crashlytics handler sends a hard crash. So, a crash from inside Kotlin turns into 2 reports. It's ugly for that reason, but without forking the Crashlytics client, there's no way to avoid that. We add tracking info, so you can find the Kotlin stack trace, but it's not ideal, obviously. The Android side is just regular Android crashlytics (1 crash report)
i

Igor Milakovic

12/10/2021, 4:46 PM
Gotcha, no big deal, as long as you can get the reports. Thanks!
k

kpgalligan

12/10/2021, 4:46 PM
Also, if you're not used to Crashlytics and Xcode, if you're running the app from Xcode and try to "crash" it, Xcode will catch the crash rather than Crashlytics. Just FYI.
i

Igor Milakovic

12/10/2021, 4:46 PM
Yep, it's gotta be a detached app run without Xcode
👍 1
c

Clive Jefferies

12/16/2021, 9:01 AM
👍
i

Igor Milakovic

12/20/2021, 4:05 PM
Hi @kpgalligan! Any ideas what might be causing these warnings when Xcode is generating the
.app.dSYM
?
warning: (x86_64)  could not find object file symbol for symbol _kfun:co.touchlab.crashkios#transformException(kotlin.Throwable;kotlin.Function3<kotlin.String,kotlin.String,kotlin.collections.List<kotlin.Long>,kotlin.Unit>){}
warning: (x86_64)  could not find object file symbol for symbol _kfun:co.touchlab.crashkios.transformException$throwableBoilerplate#internal
warning: (x86_64)  could not find object file symbol for symbol __Konan_init_co.touchlab:crashkios-core
warning: (x86_64)  could not find object file symbol for symbol GCC_except_table0
warning: (x86_64)  could not find object file symbol for symbol GCC_except_table1
warning: (x86_64)  could not find object file symbol for symbol ___unnamed_1
warning: (x86_64)  could not find object file symbol for symbol ___unnamed_2
warning: (x86_64)  could not find object file symbol for symbol ___unnamed_3
warning: (x86_64)  could not find object file symbol for symbol ___unnamed_4
warning: (x86_64)  could not find object file symbol for symbol ___unnamed_5
warning: (x86_64)  could not find object file symbol for symbol ___unnamed_6
Otherwise, everything works great, I'm getting crash reports just like you'd explained it would be
k

kpgalligan

12/20/2021, 4:13 PM
I have no idea. What versions of Kotlin and crashkios (or Kermit I guess?) I'm in the process of pushing new everything, and that long promised blog post is in mid-write...
i

Igor Milakovic

12/20/2021, 4:16 PM
Kotlin is 1.6.0 and Kermit 1.0.0
View count: 18