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

    darkmoon_uk

    02/28/2019, 12:11 AM
    Basic Gradle/MPP question: The example Gradle/MPP setups I can find online seem to be split into two definite camps: 1. Define all platforms in one module with different source sets. 2. Define each platform in it's own module, referencing another Common module - each module containing only one source set. Can anyone suggest the pro/con of each setup and why they are both presented? It's quite confusing for a newcomer to be presented with both of these as 'the way to do multi-platform'. Personally, separate modules with one source-set per module feels more natural to me: - Follows established Gradle conventions - Doesn't require learning new knowledge of Gradle's often opaque data-structures (how to configure target within module, rather than module directly) - Keeps the platform modules more loosely coupled, not defined in the same file
    j
    l
    +2
    • 5
    • 6
  • r

    Riccardo Montagnin

    02/28/2019, 8:31 AM
    Hello everyone. Is it possible to create a multiplatform project that shares code between a JVM, Android and iOS implementations? I've only found tutorials on how to create a JVM/JS/Native or Android/iOS multiplatform project, but nothing like Android/iOS/JVM and was wondering if that's supported
    :yes: 5
    r
    n
    s
    • 4
    • 6
  • r

    Riccardo Montagnin

    02/28/2019, 9:36 AM
    Is it possibile, inside
    targets
    , to place an
    android
    clause including a sibling module that is an android app? I have the current structure:
    project 
       |- android-app
       |- common
            |- commonMain
            |- iosMain
            |- jvmMain
    I would like to create some
    actual
    implementations inside the
    android-app
    module, which is an Android application module. How would I have to do? Right now when I compile the Android app the
    jvmMain
    is compiled, but I would like to provide some custom
    actual
    implementations for the Android app
    s
    r
    +3
    • 6
    • 18
  • r

    Riccardo Montagnin

    02/28/2019, 12:09 PM
    How do I run tests that are present inside
    commonTest
    ?
    s
    g
    +2
    • 5
    • 5
  • c

    CLOVIS

    02/28/2019, 5:44 PM
    Hi I've been doing Java for a few years now and fell in love with Kotlin this summer. To continue my training I'd like to begin a project in Kotlin Multiplatform as a personal proof of concept. The idea is to have an API that is an abstraction around JSON in general, and in which each platform can delegate to an existing JSON API (I don't want to reinvent the wheel, I just want a common interface). I have read the main articles about Multiplatform, but there are a few things I don't understand. What is the type of the artifacts of the common module? In JVM the artifacts are JARs and are published to MavenCentral. In the JS world it's not possible to use JARs as dependencies... So what does the common project generates? As far as I know there isn't a Kotlin specific type of artifact?
    k
    j
    n
    • 4
    • 3
  • r

    robstoll

    02/28/2019, 9:26 PM
    I consider to switch to the new multiplatform gradle plugin. Is it possible to specify compileOnly and runtimeOnly dependencies? So far I have only seen api and implementation. But maybe I don't understand ap/implementation correctly
    j
    a
    • 3
    • 4
  • m

    Marc Knaup

    03/01/2019, 12:58 PM
    How comes that
    commonMain/kotlin
    is recognized as a source folder and
    androidMain/kotlin
    is not? The Gradle view in IntelliJ also doesn't list any Android source sets 😞 https://gist.github.com/fluidsonic/04f7b15c4bc5263cd5f82632697804a4
    r
    k
    • 3
    • 20
  • j

    jeremy

    03/01/2019, 1:31 PM
    After using the new project template in IntelliJ the JVM/Android builds without issue but attempting to compile the iOS results in error "no such module app".
    s
    g
    • 3
    • 4
  • m

    Marc Knaup

    03/01/2019, 4:14 PM
    I guess annotation processing for the common module is not a thing? 🙃
    i
    l
    • 3
    • 3
  • b

    Bino

    03/01/2019, 5:09 PM
    I’m seeing low performance when using multiplatform for ios. Anyone else?
    linkSharedCodeReleaseFrameworkIos 
    BUILD SUCCESSFUL in 1m 55s
    There are only some functions in the commons module
    b
    o
    • 3
    • 2
  • p

    pardom

    03/02/2019, 2:02 PM
    Could I get a review on this script? I'm wondering if I really need to setup all the coroutine dependencies explicitly. Also, what does the Android target do that the JVM target doesn't? https://github.com/pardom/oolong/blob/master/oolong/build.gradle.kts
    r
    • 2
    • 1
  • r

    Robert

    03/03/2019, 12:39 PM
    Anyone can tell me why I get this error and how I should solve it? https://gist.github.com/RdeWilde/74d76d5a4ab736184aa14808b00fc4c9
    d
    r
    • 3
    • 3
  • l

    louiscad

    03/03/2019, 6:40 PM
    I migrated Android library modules to Kotlin Multiplatform gradle module, and now, the tests in
    androidTest
    are run as unit tests without instrumentation, making them fail (they are run on the computer without Android OS with no option to run it from an Android device/emulator). Where should I put my instrumented tests, or how should I configure my module to get instrumentation back?
    k
    b
    y
    • 4
    • 8
  • m

    manijshrestha

    03/04/2019, 3:42 PM
    Has anyone encountered an issue with an iOS app that includes kotlin multiplatform code crashes on start on iPhone 5c when downloaded from app store? Local build works fine, ipa from app store seems to have this issue.
    j
    • 2
    • 5
  • r

    Riccardo Montagnin

    03/05/2019, 9:14 AM
    Hello everyone, how do I include all the
    androidMain
    dependencies into
    androidTest
    ? Should I just copy/paste them or is there a better method to do it, like a reference?
    l
    g
    +3
    • 6
    • 22
  • r

    Riccardo Montagnin

    03/05/2019, 9:49 AM
    How do I test the fails of a test that relies on a
    suspend
    funciton? Let's consider this class
    /**
     * Allows the login of a user based on his private key.
     */
    class PerformLoginUseCase internal constructor(private val repository: AuthenticationRepository){
    
        /**
         * Logs the user into the system using the given [authKey].
         * @return the user data once the login has been successful.
         */
        suspend operator fun invoke(authKey: PrivateKey): UserData {
            return repository.login(authKey)
        }
    }
    I have the following test
    @Test
    fun useCaseThrowsExceptionWhenRepositoryDoes() {
        assertFailsWith(Throwable::class) {
            coEvery { repository.login(any()) } throws Throwable()
            GlobalScope.launch { performLogin(mockk()) }
        }
    }
    While this should work properly, it fails with an
    assertionError
    . I think the exception is not raised in time, so who should I do this?
    g
    • 2
    • 14
  • r

    ribesg

    03/05/2019, 10:23 AM
    I have some problems with dependencies, what is the correct way, in a MPP, to use a MPP library as a dependency?
    sourceSets {
    
            val commonMain by getting {
                dependencies {
                    api("mygroup:mympplib:0.0.1-SNAPSHOT")
                }
            }
    
            val androidMain by getting {
                dependencies {
    
                }
            }
    
            for (iosTarget in iosTargets) {
                getByName("${iosTarget.name}Main") {
                    dependencies {
    
                    }
                }
            }
    
        }
    r
    o
    • 3
    • 9
  • g

    GarouDan

    03/05/2019, 2:32 PM
    I’m trying to use the kotlin
    1.3.30-eap-11
    version, but I’m receiving this error:
    * What went wrong:
    Plugin [id: 'org.jetbrains.kotlin.multiplatform', version: '1.3.30-eap-11'] was not found in any of the following sources:
    
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:1.3.30-eap-11')
    I’m trying to use this in my `build.gradle.kts`:
    buildscript {
    	repositories {
    		maven { url = uri("<https://dl.bintray.com/kotlin/kotlin-eap>") }
    ...
    	dependencies {
    		classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.30-eap-11")
    ...
    }
    
    allprojects {
    	repositories {
    		maven {
    			url = uri("<https://dl.bintray.com/kotlin/kotlin-eap>")
    			content {
    				excludeGroup("Kotlin/Native")
    			}
    		}
    ...
    Am I missing something? Edit: The error is happening here (in my root
    build.gradle.kts
    file):
    plugins {
    	kotlin("multiplatform") version "1.3.30-eap-11"
    }
    a
    • 2
    • 5
  • m

    Marc Knaup

    03/05/2019, 3:44 PM
    Will that limitation be lifted at some point?
    👍 3
    i
    • 2
    • 2
  • p

    pardom

    03/05/2019, 9:17 PM
    Otherwise how would it be distributed.
    👍 1
    b
    • 2
    • 1
  • p

    pardom

    03/05/2019, 9:25 PM
    Has anyone seen a better publishing script than this? https://github.com/square/sqldelight/blob/master/gradle/gradle-mvn-mpp-push.gradle
    k
    g
    • 3
    • 43
  • b

    bdeg

    03/05/2019, 10:04 PM
    is there a gradle plugin to publish kotlin multiplatform ios framework to CocoaPods?
    b
    a
    +4
    • 7
    • 30
  • j

    juliocbcotta

    03/06/2019, 12:59 AM
    Hi, I am trying to update a project from the old format for mpp projects to the current format, but I stuck with a problem when running the android app... it seems that the Activity is not found in the main dex...
    2019-03-05 21:46:22.422 25541-25541/br.com.youse.forms.app E/AndroidRuntime: FATAL EXCEPTION: main
        Process: <http://br.com.youse.forms.app|br.com.youse.forms.app>, PID: 25541
        java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{<http://br.com.youse.forms.app/br.com.youse.forms.samples.form.FormLoginActivity|br.com.youse.forms.app/br.com.youse.forms.samples.form.FormLoginActivity>}: java.lang.ClassNotFoundException: Didn't find class "br.com.youse.forms.samples.form.FormLoginActivity" on path: DexPathList[[zip file "/data/app/br.com.youse.forms.app-B2ycXZrm8-D79TrXtKX7Iw==/base.apk"],nativeLibraryDirectories=[/data/app/br.com.youse.forms.app-B2ycXZrm8-D79TrXtKX7Iw==/lib/x86, /system/lib, /vendor/lib]]
    ...
         Caused by: java.lang.ClassNotFoundException: Didn't find class "br.com.youse.forms.samples.form.FormLoginActivity" on path: DexPathList[[zip file "/data/app/br.com.youse.forms.app-B2ycXZrm8-
    I did check if the Activity in the AndroidManifest is right and I could run the same
    :app
    code switching the local mpp project to a published dep. I also can ran the unit tests from commonTest just fine. Does anyone has ran into something like that? I uploaded my current work here https://github.com/BugsBunnyBR/forms-mpp-problem if anyone want to take a look...
    j
    • 2
    • 6
  • d

    Diogo Ribeiro

    03/06/2019, 1:27 PM
    Hi guys, somebody is working on an UI library? I cannot override UITableViewDataSource property on kotlin. What am I doing wrong? Is it supported?
    m
    s
    +5
    • 8
    • 12
  • r

    Riccardo Montagnin

    03/06/2019, 3:42 PM
    Hello everyone. Where should I put the sources folder in order to have
    actual
    classes for the android instrumented tests? Right now I'm putting them into
    androidTest
    , but they are executed as unit tests. If I try running
    gradle checkConnected
    I get the following error:
    Expected object 'XYZ' has no actual declaration in module
    How should I configure the project to have instrumented tests?
    k
    • 2
    • 3
  • m

    Marc Knaup

    03/06/2019, 4:52 PM
    Will multiplatform for iOS become more Swift-like? I can't believe
    NSInteger
    is back 😢
    k
    r
    +3
    • 6
    • 9
  • m

    max.cruz

    03/06/2019, 5:34 PM
    Hello. I’m having an issue with a shared library iOS/Android. When including the framework in XCode:
    @property (readonly) double double;
    @property (readonly) float float;
    @property (readonly) int32_t int;
    Apparently symbols generated by Kotlin Native aren’t compatible with Objective C
    o
    • 2
    • 1
  • i

    ivan.savytskyi

    03/06/2019, 6:43 PM
    Hey folks, I’m trying to find out why for some classes defined on KN there is strange name generated (in header files), for example:
    __attribute__((swift_name("Kotlinx_coroutines_core_nativeCoroutineDispatcher")))
    @interface MainKotlinx_coroutines_core_nativeCoroutineDispatcher : MainKotlinAbstractCoroutineContextElement <MainKotlinContinuationInterceptor>
    
    __attribute__((swift_name("Ktor_client_coreHttpClientEngineConfig")))
    @interface MainKtor_client_coreHttpClientEngineConfig : KotlinBase
    
    etc.
    And it looks weird on Swift side to have smth like this
    public class UICoroutineContext: Kotlinx_coroutines_core_nativeCoroutineDispatcher
    o
    • 2
    • 2
  • p

    pardom

    03/06/2019, 9:38 PM
    Kotlin mpp is converting my generic type parameters to
    Any?
    . Is this expected?
    k
    • 2
    • 1
  • p

    pardom

    03/06/2019, 9:40 PM
    Should I just type cast in this case?
    k
    • 2
    • 2
Powered by Linen
Title
p

pardom

03/06/2019, 9:40 PM
Should I just type cast in this case?
k

kpgalligan

03/06/2019, 10:44 PM
Yeah
p

pardom

03/07/2019, 4:48 PM
I did this to get around the generic types, but I’m getting
kotlin.TypeCastException
elsewhere and don’t know how to debug K/N yet: https://github.com/pardom/oolong/pull/16/files#diff-b6307a0524635d6d8940c58b27823806R48
View count: 2