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
  • k

    Kris Wong

    12/02/2020, 4:42 PM
    > Cannot find a version of 'org.jetbrains.kotlinx:kotlinx-coroutines-core' that satisfies the version constraints:
               Dependency path 'TelemetrySampleAndroid:app:unspecified' --> 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' --> 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
               Dependency path 'TelemetrySampleAndroid:app:unspecified' --> 'com.airwatch.act:TelemetryModule:1.0.0' --> 'com.airwatch.act:TelemetryModule-android-debug:1.0.0' --> 'org.jetbrains.kotlinx:kotlinx-coroutines-core:{strictly 1.4.2-native-mt}'
    anyone have a workaround for this?
    • 1
    • 1
  • f

    Forrest Pangborn

    12/02/2020, 9:42 PM
    Hi folks 👋 I'm trying to add multiplatform support slowly to a relatively large Android codebase and have started with trying to convert some pretty foundational modules to
    multiplatform
    type from
    jvm
    or
    com.android.library
    . This has been working alright, but I recently ran into a problem when when I tried to introduce a dependency on a
    multiplatform
    module (with a
    jvm
    target) in a
    jvm
    module; Android Studio fails to resolve classes defined in the
    commonMain
    sourceset of the
    multiplatform
    module while inside the
    jvm
    module. However, everything compiles and packages fine from CLI so I'm wondering if this is an Android Studio bug. I have a sample project exhibiting this - but am wondering if this a known limitation or if anyone else has experienced this before.
    s
    • 2
    • 4
  • s

    Slackbot

    12/02/2020, 11:32 PM
    This message was deleted.
    j
    • 2
    • 1
  • p

    Philip Dukhov

    12/03/2020, 2:12 AM
    Kotlin objects seems not releasing when created in swift code. I have a sample kotlin class `class Test {}`:
    var test: Test?
    weak var testW: Test?
    
    func f() {
    	testW = Test()
    	print(testW) // non nil, unlike Swift class instance. 
    	DispatchQueue.main.async { [weak self] in
    	    print(self?.testW) // now nil, kind of ok
    	}
    }
    
    func f() {
    	test = Test()
    	testW = test
    	DispatchQueue.main.async { [weak self] in
    	    self?.test = nil
    	}
    	DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
    	    print(self?.testW) // not nil, seems it's not gonna be released, we have a leak
    	}
    }
    Why in the second case it not get’s release at all? It shouldn’t be captured by the block.. How can I release a kotlin object?
    a
    • 2
    • 4
  • p

    Philip Dukhov

    12/03/2020, 7:47 AM
    My module is for ios/android. I’ve got an error
    IncorrectDereferenceException: illegal attempt to access non-shared ...
    the object is created in
    commonMain
    part of the code, on a background thread. if I switch to main thread on kotlin part it works fine. but if I switch on iOS one, this crash occurs on access to the object. looks like
    freeze()
    is only available from ios part. Or am I missing some imports? How can I freeze an object in common code?
    n
    a
    • 3
    • 3
  • d

    Devendra Patel

    12/03/2020, 5:27 PM
    Hello folks, I am following https://kotlinlang.org/docs/mobile/create-first-app.html tutorial and am wondering if there is a way to add tvOS target as well. I am an iOS/tvOS developer with limited understanding for gradle build system so please bear with me. Also if this is not the right channel please point me to the right one, thanks.
    t
    • 2
    • 11
  • a

    aleksey.tomin

    12/04/2020, 4:08 AM
    In java exists some library with some class and interface. I’ve created except/actual interface in kotlin-multiplatform. And my interface is the same as jvm interface. Can I join my expect kotlin interface and jvm actual interface/class?
    r
    • 2
    • 2
  • n

    nrobi

    12/04/2020, 8:00 AM
    @alex009 any plans on adding macOS target also to moko-resources?
    a
    • 2
    • 7
  • l

    Lena Stepanova

    12/04/2020, 9:40 AM
    Hello everyone, is there a way to use string resources in shared models? For example, in KampKit in BreedModel instead of writing
    return "Unable to download breed list"
    in code, I want to write something similar to android's
    return getString(R.string.download_error)
    , so that it's easier to edit those strings in one common file
    a
    h
    • 3
    • 2
  • e

    Elyes Ben Salah

    12/04/2020, 11:57 AM
    Hello guys , what is the best way to use Native libraries in both Apps , however there is the same lib implementation in both platforms Swift And Java (Libsodium)
    c
    h
    • 3
    • 10
  • j

    Joost Van Wynen

    12/04/2020, 1:20 PM
    Hey everybody, I am trying to add Jetpack Compose to my KMM project and specifically the Android app, however it is not cooperating. I get this error:
    java.lang.IncompatibleClassChangeError: Found class org.jetbrains.kotlin.ir.declarations.IrModuleFragment, but interface was expected
    . I think it has something to do with incompatible versions of Kotlin or some dependency, so I am trying to follow the example given by the KMM sample docs. Does anyone know which direction to look for a fix?
    n
    j
    • 3
    • 11
  • s

    SrSouza

    12/04/2020, 5:04 PM
    Hi folks, anyone knows if there is a Gradle plugin or a library for KMM to share vectors between Android and iOS apps?
    m
    d
    • 3
    • 7
  • f

    Fanis Paschos

    12/05/2020, 12:12 AM
    Hello, I hope everyone is doing alright…I am quite new to KMM and I am struggling with creating a fat-jar w/ Shadow plugin. I do not really know how to add the task and then run it. Even though I have already added it in shared gradle and Synced project, it does not appear in the right side bar in shared tasks. May anyone give me a bit of help? thank you all 🙂
    l
    f
    • 3
    • 52
  • s

    Sourabh Rawat

    12/05/2020, 6:20 AM
    What is the difference between specifying jvmTarget with
    kotlin {
    
       targets {
          jvm {
             compilations.all {
                kotlinOptions {
                   jvmTarget = "1.8"
                }
             }
          }
       }
    }
    and
    tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
       kotlinOptions.jvmTarget = "1.8"
    }
    k
    • 2
    • 2
  • r

    Ravin Jain

    12/05/2020, 6:26 AM
    Hi I am new to KMM. After using cocoapod to add an external dependency. Trying to import using 
    import cocoapods.<libraryname>.*
     but its not able to find the library. Also when i build using
    ./gradlew build
    getting error
    at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
            at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:68)
            at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:14)
            at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:507)
            at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:265)
            at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:73)
            at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45)
            at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:19)
            at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:41)
    Any help ?
    f
    k
    • 3
    • 5
  • d

    Daniele B

    12/05/2020, 1:57 PM
    Trying to summarize the difference between the apps of the “past” and the apps of the “future”:
    s
    r
    +4
    • 7
    • 33
  • p

    Paul Woitaschek

    12/07/2020, 8:37 AM
    Is it possible to exclude a native source set for tests? I’m using kotest assertions but it has no support for watchosArm32. So gradle fails because it’s trying to look up that dependency. Therefore I want to exclude that one in tests.
    r
    • 2
    • 1
  • с

    Соловьев Георгий

    12/07/2020, 10:29 AM
    How can I disable
    kotlinMultiplatform
     MavenPublication? I have a android project :cabinet, that depends on multiplatfom project :cabinetcore through
    api project(':cabinetcore')
    . When I try to publish :cabinet I've got this error. I don't need
    kotlinMultiplatform
    publication, only
    release
    (which is mine publication). How can I disable its automatic creation?
    a
    p
    • 3
    • 11
  • d

    Daniele B

    12/07/2020, 2:12 PM
    Just created this new slide, summarizing what are the new components to use with KMP:
    👍 13
    b
    h
    • 3
    • 7
  • d

    Daniele B

    12/07/2020, 6:26 PM
    Also sharing another slide, comparing Imperative and Declarative UI, and showing why KMP shines with Declarative UIs
    ✅ 2
    g
    j
    +5
    • 8
    • 73
  • a

    Amritansh

    12/07/2020, 7:49 PM
    Hey, I am trying to add a pod dependency in my KMM project but I am getting an error when I am syncing
    Executing of 'pod gen --platforms=ios --gen-directory=/Users/atripathi/<Project Root>/shared/build/cocoapods/synthetic/iosArm64 dogtag.podspec' failed with code 1 and message:
    [!] Unknown command: `gen`
    Did you mean: env?
    cocoapods {
        frameworkName = "shared"
        pod("Connectivity")
    }
    I should also specify here that the first step mentioned here https://kotlinlang.org/docs/reference/native/cocoapods.html#install-the-cocoapods-dependency-manager-and-plugin is failing for me when I run the command so I used`brew install cocoapods`
    ERROR:  Error installing cocoapods:
            ERROR: Failed to build gem native extension.
    
        current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.13.1/ext/ffi_c
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20201207-63679-1jx757c.rb extconf.rb
    mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
    
    extconf failed, exit code 1
    
    Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.13.1 for inspection.
    Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.13.1/gem_make.out
    my project is working fine on iOS when I remove pod() dependency. I am kind of confused here where things are going wrong
    a
    • 2
    • 4
  • a

    Alex

    12/07/2020, 8:26 PM
    Hi everyone. I'm gonna start working on a KMM project next week and I'm worried about what's the appropriate DI framework to use. So far, I've seen most of the people are using Koin or Kodein. I don't have any real experience with any of them. Does anyone know which one's better suited for KMM and why? I've couldn't find any good article about it.
    g
    k
    • 3
    • 2
  • j

    Javier

    12/08/2020, 12:30 AM
    Someone here can help me?
    • 1
    • 1
  • p

    Paul Woitaschek

    12/08/2020, 7:41 AM
    We're having issues with building a shared framework:
    Both watchos-armv7k and watchos-arm64_32 represent two equivalent library definitions.
    We're building the framework like this:
    xcodebuild -create-xcframework \
    -framework ios/build/xcode-frameworks/iosArm64/SharedCode.framework \
    -framework ios/build/xcode-frameworks/iosX64/SharedCode.framework \
    -framework ios/build/xcode-frameworks/watchosArm64/SharedCode.framework \
    -framework ios/build/xcode-frameworks/watchosX86/SharedCode.framework \
    -framework ios/build/xcode-frameworks/watchosArm32/SharedCode.framework \
    -output "$XCFRAMEWORK_DESTINATION_DIR"/SharedCode.xcframework
    Did someone manage to get arm32 and arm64 working together for kotlin native on ios / watchos?
    l
    k
    s
    • 4
    • 27
  • a

    aiidziis

    12/08/2020, 12:14 PM
    Has anyone managed to add
    SQLCipher
    ? Went through example: https://github.com/touchlab-lab/KaMPKitSQLCipher . Project actually builds on Xcode and works properly, but now I am having problems with
    publishToMavenLocal
    . When I run
    gradlew publishToMavenLocal
    this error is getting thrown:
    Execution failed for task ':KME:cinteropSQLCipherIos'.
    > Cannot perform cinterop processing for module SQLCipher: cannot determine headers location.
    k
    • 2
    • 3
  • d

    Daniele B

    12/08/2020, 2:54 PM
    Following yesterday’s post and “heated” thread discussion, which was really helpful, I am now presenting a new diagram, which hopefully clarifies the points and removes the confusion. @jw made very meaningful observations, by pointing out that architecturally there is no difference at all between Declarative and Imperative UIs. You can apply MVI/unidirectional data flow in exactly the same way, for both. My yesterday’s diagram was indeed confusing, by hinting a unidirectional data flow just for the Declarative UIs. But there is an important difference between Declarative and Imperative UIs, and that is cohesion. In Declarative UIs, you just have 1 layer (Compose/SwiftUI), while in Imperative UIs, you have 2 layers (one of Kotlin/Swift code, and one of XMLLayout/InterfaceBuilder). This also means that each UI component introduces an extra relationship (coupling) between the 2 layers, which needs to be managed, with extra boilerplate code. Android has been trying to minimize this problem by introducing the ViewBinding, but the same mechanism doesn’t exist in iOS InterfaceBuilder, where the coupling between the 2 layers needs to be kept updated manually. Declarative UIs don’t have this low-cohesion issue, as the data can be applied directly on the UI layout, without an extra middle layer. This removes a lot of boilerplate code and clearly speeds up development.
    👍 3
    k
    d
    • 3
    • 6
  • h

    Hamza GATTAL

    12/08/2020, 10:48 PM
    Multiplatform project to implement server side jvm and client side android and jvm Is that possible it mean with two jvm targets
    k
    b
    • 3
    • 6
  • y

    yshrsmz

    12/09/2020, 8:36 AM
    what is the difference between this channel and #kotlin-multiplatform 🤔
    👀 4
    j
    • 2
    • 1
  • s

    SrSouza

    12/09/2020, 12:42 PM
    Hi folks, there is any library to help with i18n for KMM project?
    m
    • 2
    • 3
  • a

    Amritansh

    12/09/2020, 11:56 PM
    Hi, I tried accessing
    NWPathMonitor
    in Network but it was not resolved even after I imported
    import platform.Network.*
    . Is this something not available for ios on KMP? https://developer.apple.com/documentation/network/nwpathmonitor
    t
    • 2
    • 2
Powered by Linen
Title
a

Amritansh

12/09/2020, 11:56 PM
Hi, I tried accessing
NWPathMonitor
in Network but it was not resolved even after I imported
import platform.Network.*
. Is this something not available for ios on KMP? https://developer.apple.com/documentation/network/nwpathmonitor
t

Thomas Myrden

12/09/2020, 11:57 PM
Swift-only classes like that won't be available to KMP. Need to have Obj-C interfaces to be accessible
a

Amritansh

12/09/2020, 11:58 PM
got it, that makes sense. Thanks
View count: 14