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

    mboudraa

    01/27/2021, 9:34 PM
    Hello everyone, This is my 1st time with kotlin multiplatform. I’m trying to write and run unit tests for the android target. However I’d like those unit tests to be jvm only. For example, everytime, I try to run my tests, I have an emulator that is started. I’d like to avoid that and run them only in jvm mode. Is it possible?
    k
    • 2
    • 7
  • w

    wuseal

    01/28/2021, 2:42 AM
    Hi, bros, I found a bug in Android Studio : 1. Composite build cant reference shared library class in commonMain by Android Studio, but I can manually import the class into main project by writing
    import com.xxxxx.xx.xx.X
      The android Studio doesn't tips you to do auto import classes Android Studio Version: 4.2 beta3 Gradle Version: 6.5 Kotlin Plugin Version : 1.4.21-release-Studio4.2-1 KMM Plugin: 0.2.0-release-65-Studio4.2 JVM: 15 Kotlin: 1.4.21 Can you guys understand what i mean? And how to let people to resolve this problem? I need this coding style with gradle composite build to Isolate the KMM build environment 😊
    m
    m
    • 3
    • 5
  • p

    PengChunxiao

    01/28/2021, 9:26 AM
    How to use GRPC on multiplatform
    h
    • 2
    • 1
  • y

    Yaniv Sosnovsky

    01/28/2021, 11:22 AM
    Hi guys. I’m trying to use ‘TrueTime’ pod in KMM and gradle sync keeps failing with the following error:
    Task :core:cinteropTrueTimeIos
    Exception in thread “main” java.lang.Error: /Users/yanivsos/Documents/Projects/Texel/old-co-view-sdk/core/build/cocoapods/synthetic/IOS/core/build/Release-iphonesimulator/TrueTime/TrueTime.framework/Headers/TrueTime.h9️⃣1: error: use of ‘@import’ when modules are disabled Any idea on how to fix it?
    a
    k
    • 3
    • 5
  • m

    magnumrocha

    01/28/2021, 6:37 PM
    does anyone having problem after update Android Studio Arctic Fox Canary 5 (2020.3.1.5) ?
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    lateinit property variantName has not been initialized
    j
    s
    +3
    • 6
    • 85
  • a

    Andy Victors

    01/29/2021, 10:28 AM
    Hi all, I have a conceptual question. I want to provide a HTTP REST API Wrapper as MPP library. As far as I investigated
    ktor
    it does not manage async execution for me - the requests API is
    suspend
    based. So I think I have two options: A) Manage async execution by coroutines inside the common MPP code. From what I recall trying similar things a year ago, there are headaches configuring coroutine contexts for iOS and also some limitations (main thread only). So I am not sure if it all will work at all. B) Or, I can put async logic into platform code. More code but ok. But still, will I be able to call
    suspend
    marked methods from iOS? I'd like to have thoughts on this topic from more experienced folks.
    t
    k
    m
    • 4
    • 23
  • w

    wuseal

    01/29/2021, 11:48 AM
    Hi,guys, how i can solve this problem when i use cocoapod plugin to integrate into iOS project?
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    A problem occurred configuring project ':mpplib'.
    > No enum constant org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.DEV
    • 1
    • 1
  • n

    nlindberg

    01/29/2021, 6:29 PM
    Anyone have a good .gitignore template for a kmp project?
    a
    • 2
    • 1
  • f

    Francis Mariano

    01/29/2021, 7:59 PM
    Hello guys. After to update xcode to 12.4 version I am getting the following message error:
    Building for iOS, but the linked and embedded framework 'shared.framework' was built for iOS Simulator.
    In previous Xcode version that behaviour did not happened, I changed from simulator to real device and vice-versa so the packtoXCode executed again Did anyone see that already?
    d
    a
    • 3
    • 4
  • d

    darkmoon_uk

    02/01/2021, 3:08 AM
    When depending on a KMP project module in an Android project, is there an idiomatic way to prevent the iOS target being compiled? This slows down development cycles in the Android Studio IDE and is wasted effort.
    z
    • 2
    • 1
  • s

    Shawn Tucker

    02/01/2021, 9:51 AM
    Hey, I am having trouble importing atomicfu to my project. I get compilation error when I try to add the common dependency. If I skip it, I get MethodNotFound crashes is my Android build. any ideas?
    b
    • 2
    • 1
  • a

    Anthony f

    02/01/2021, 1:48 PM
    Hi, I wonder if there is somewhere an example with a multi module kmm project. I tried to split my ":shared" module into 2 modules, and it failed then, when I added a third module in a bottom layer with common architecture stuff in commun module. Any idea or link to help me ?
    s
    • 2
    • 2
  • j

    jossiwolf

    02/01/2021, 2:54 PM
    Is KMM plugin support for the latest Arctic Fox canaries planned?
    t
    d
    b
    • 4
    • 4
  • h

    Himanshu Singh

    02/01/2021, 4:53 PM
    With KMP Plugin in Android Studio. I am not able to add configuration for ios app. Is there anything I might be missing?
    j
    • 2
    • 1
  • r

    Reed Ellsworth

    02/02/2021, 5:19 AM
    For multiplatform logging I could not find a library that had all the features I needed so I ended up writing one. Please check out KmLogging. Initially it supports Android, iOS, and JS. The features it implements is: • Uses platform specific logging on each platform: Log on Android, os_log on iOS, and console on JavaScript. • High performance. Only 1 boolean check when disabled. I like to put in lots of logging and want all of it turned off when releases and do not want to pay much overhead for having lots of logging. Also, when logging is on it needs to be really performant. • Extensible. Need to be able add other loggers such as logging to Crashlytics, etc. • Each logger can log at a different level. For example, you may only want info and above going to Crashlytics and all other loggers disabled in production. I would love to hear your feedback.
    👍 6
    s
    • 2
    • 1
  • i

    ivano

    02/02/2021, 8:44 AM
    by the way of official ways, I cannot find any recent tutorial with compose, ktor, android plugin, clean or mvvm architecture with a github repository. Is difficult to set up, There is nothing constantly updated?
    • 1
    • 1
  • r

    Ran

    02/02/2021, 8:46 AM
    stringByAddingPercentEncodingWithAllowedCharacters
    doesn’t work on Kotlin Native. My code is like following:
    actual fun urlEncode(url: String) : String {
        val set = NSCharacterSet.URLQueryAllowedCharacterSet().mutableCopy() as NSMutableCharacterSet
        set.addCharactersInString("+&")
        return NSString.create(string=url).stringByAddingPercentEncodingWithAllowedCharacters(
            allowedCharacters = NSCharacterSet.URLQueryAllowedCharacterSet()
        ) ?: ""
    }
    My test code:
    @Test
    fun testUrlEncode() {
        assertEquals(
            "https%3A%2F%2Fmontageapps.com%3Ftoken%3Drth%26price%3Dinvaluable",
            urlEncode("<https://montageapps.com?token=rth&price=invaluable>")
        )
    }
    Test result:
    kotlin.AssertionError: Expected <https%3A%2F%<http://2Fmontageapps.com|2Fmontageapps.com>%3Ftoken%3Drth%26price%3Dinvaluable>, actual <<https://montageapps.com?token=rth&price=invaluable>>.
    a
    • 2
    • 3
  • r

    Ran

    02/02/2021, 10:16 AM
    Cannot create resource directory for android module in KMM shared module:
    l
    • 2
    • 3
  • m

    Michal Klimczak

    02/02/2021, 10:18 AM
    Hey guys, remember the library for coroutine wrappers created from annotations? It's now called Koru, I've fixed a few things about it and wrote an introductory article https://medium.com/futuremind/handling-kotlin-multiplatform-coroutines-in-swift-koru-4a80b93f232b. Enjoy 🙂
    👍 6
    🙌 5
    m
    r
    p
    • 4
    • 5
  • p

    Paul Woitaschek

    02/02/2021, 4:54 PM
    Would it be possible to uss KSP to freeze every object in its initialization? Our code is super fragile because we basically always need to remember to freeze all the objects we create or we see crashes on ios
    j
    • 2
    • 5
  • p

    ptsiogas

    02/02/2021, 5:01 PM
    Is there a way to check device’s network connection in common code or we have to write platform specific code? Are there any working examples?
    a
    j
    a
    • 4
    • 11
  • d

    Daniel Burnhan

    02/02/2021, 11:03 PM
    Hi all. Super new guy here. I’ve started developing an app sharing code between iOS and Android. I’m having the hardest time getting an IDE setup that supports KMM and jet pack compose. My swift UI and common code is about 50% done but haven’t been able to work on Android UI because the ide gives me errors when I go to newest canary for Android studio. Any body have a working setup?
    j
    • 2
    • 3
  • n

    Neal Sanche

    02/03/2021, 12:34 AM
    Hi all, I've been trying to call a method that takes a nullable Int in Kotlin common code from Swift. The method signature is:
    suspend fun getEpisodes(page: Int?): EpisodePage
    On the Swift side, have been try to write code but always am told:
    Cannot convert value of type 'Int32' to expected argument type 'KotlinInt?'
    This confuses me, and I'm sure there's a simple explanation. I can change the function signature to
    getEpisodes(page: Int = 1)
    instead, and that's much easier to deal with. So I'm curious what's going on here?
    b
    • 2
    • 12
  • j

    John O'Reilly

    02/03/2021, 1:46 PM
    Are there any plans for KMM Android Studio plugin to start using CocoaPods integration when creating projects (https://kotlinlang.org/docs/native-cocoapods.html)?
    👍 1
    m
    j
    d
    • 4
    • 13
  • h

    Hannes

    02/03/2021, 2:35 PM
    Hey, does anyone know if Garmin OS (for their smart watches) works with Kotlin Native?
    b
    • 2
    • 1
  • c

    cafonsomota

    02/03/2021, 3:04 PM
    Hello all, I’m making some tests here with KMP multi-modules but I think I’m doing something wrong in terms of configurations. I’ve got: • KMP project (library) no 1 • KMP project (library) no 2 (makes use of library no 1) • Android/iOS app that use both libraries I can successfully compile each library individual. But when I try to import lib no1 intro lib no2 on Android Studio (via settings.gradle) I’ve got a couple of errors: • It’s unable to find buildSrc • It complains as not having any target defined (I’m using gradle 6.8.1 and plugin 7.0.0-alpha05) Any idea what I might be doing wrong?
    m
    • 2
    • 6
  • s

    Sebastian Kaspari

    02/03/2021, 4:25 PM
    Is it possible to ship non-code resources in a Kotlin multiplatform library? I assume not (yet?) because it’s tricky and unclear where they should end up depending on platform? Has anyone explored that?
    m
    b
    k
    • 4
    • 6
  • g

    gammax

    02/04/2021, 12:26 AM
    Hey all 👋 I’m trying to adapt a Gradle plugin to KMP. I’m having a hard time accessing the classpaths of the various source sets/targets. I’m unsure if trying to access a classpath makes sense for native/js targets, but there should definitely be a way to access jvm/android classpaths. Am I the only one facing this? Do you have some examples or other plugins that might be doing this to share?
    r
    j
    n
    • 4
    • 7
  • j

    Jeff Lockhart

    02/04/2021, 1:13 AM
    Is it possible to use Java code as part of an actual implementation in android/jvm source set? I have the Java class implemented and my code compiles, but at runtime the app crashes with
    java.lang.NoClassDefFoundError: Failed resolution of: Lpackage/of/my/JavaClass;
    I need to workaround a Kotlin/Java interop bug in a library where an enum is not accessible in Kotlin because it is part of a non-accessible parent class.
    r
    b
    a
    • 4
    • 6
  • a

    andylamax

    02/04/2021, 10:27 AM
    any known multiplatform http clients that don't use coroutines?
    a
    l
    d
    • 4
    • 5
Powered by Linen
Title
a

andylamax

02/04/2021, 10:27 AM
any known multiplatform http clients that don't use coroutines?
a

aleksey.tomin

02/04/2021, 11:15 AM
You can use curl lib directly. I’ve been doing it until I’ve started use ktor-curl-client.
l

louiscad

02/04/2021, 11:48 AM
I'm curious about why you're looking for one that is not using coroutines 🤔
👍 6
a

andylamax

02/04/2021, 7:16 PM
coroutines are currently very heavy on browsers. So, I am doing my best to avoid them if I am writing code that is eventually going to be executed by one. Also, curl lib isn't multiplatform, as I believe it doesn't work in browsers
d

Daniele B

02/04/2021, 10:38 PM
@andylamax I suggest you to follow this issue: https://youtrack.jetbrains.com/issue/KTOR-1084
a

andylamax

02/05/2021, 4:32 AM
Thanks @Daniele B I already follow that issue
View count: 13