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

    markusa

    07/08/2019, 7:18 PM
    is there a way to let the multiplatform tests create junit xml results? (not only for jvm)
    d
    • 2
    • 2
  • n

    Nikky

    07/09/2019, 9:32 AM
    so i am trying to use multiplatform with gradle-kts and for some reason on dependencies block api and implementation seem to be special cases and they work (although only with a single string input, no splitting into group, name, version) and compile or even custom configurations do not work at all using gradle 5.5 and kotlin 1.3.40 the custom configuration is set up in a plugin in buildSrc
    DefaultKotlinDependencyHandler
    seems to not handle things that the nromal dependencies block ca.. or maybe its just the kts bit thats broken ?
    h
    • 2
    • 2
  • k

    kpgalligan

    07/09/2019, 2:16 PM
    I’m a little new with the JS side of multiplatform. Running tests with backtick names does not work. Is that just the way I have it configured, or do backtick names need JsName on them?
    h
    • 2
    • 5
  • a

    addamsson

    07/09/2019, 11:08 PM
    I'm looking for a library for kotlin common which has persistent data structures and I just bumped into this one: https://github.com/Kotlin/kotlinx.collections.immutable i'm wondering why is this not a multiplatform project? Do any of you have experience with this?
    e
    • 2
    • 1
  • a

    altavir

    07/10/2019, 8:09 AM
    Could you remind me how to add JavaExec task to mutliplatform? I believe it was answered several times, but I forgot again.
    d
    • 2
    • 7
  • m

    Marc Knaup

    07/10/2019, 9:29 PM
    What am I doing wrong if the JVM version attribute is used for resolving dependencies but when publishing the artifact the attribute is unexpectedly absent from the published
    .module
    ?
    jvm {
    	attributes {
    		attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 7)
    	}
    }
    It does work in another multiplatform library which has multiple JVM targets. Update: Got it. It happens if I dare to call
    subprojects { apply<MavenPublishPlugin>() }
    . Is that a bug in MP or Gradle?
    h
    • 2
    • 3
  • a

    Alejandro Rios

    07/11/2019, 1:26 AM
    Hello Beautiful people, i'm new in this slack, working with Kotlin on Android and it's really cool, recently i was searching about
    Kotlin Native-Multiplatform
    in Medium articles and the page of raywenderlich, can you share please more resources to check?? Thanks
    👋 2
    s
    • 2
    • 2
  • c

    Cyrille QUÉMIN

    07/11/2019, 11:12 AM
    Hey guys, kotlin co routine multiplatform mentioned that it is single thread (js style) on native platform. Is it exactly like JS with a delegation principal to a background thread? Or does everything solely run on the main thread ??? If so. Is there a way to "hook" it up to iOS dispatch system in order to have at least one more thread to be able to do computation in the background and updating progress on the main thread for example?
    g
    a
    • 3
    • 5
  • s

    Sergioedcigreja

    07/11/2019, 12:58 PM
    Hello everyone, I'm trying to get a device id from both platforms however I'm having trouble with android. I can't seem to use the android sdk in the androidMain module. I've already set the sdk.dir in local.properties so I don't know if I'm missing something..
    k
    s
    l
    • 4
    • 13
  • a

    alex.hart

    07/12/2019, 1:10 PM
    I don’t think you can do this, because the T of MyClass is erased at compile time, isn’t it? What benefit is reification giving you in your suspend fn?
    f
    b
    • 3
    • 3
  • m

    markusa

    07/13/2019, 9:05 AM
    Is there a way to exclude sources by pattern with the multiplatform plugin? What I did before:
    sourceSets {
        main {
            kotlin {
                srcDir 'src/main/kotlin'
    
                if(isAndroid) {
                    exclude '**/*Backtick*'
                }
            }
        }
    now I have
    kotlin {
        jvm()
        jvm('android')
        jvmMain {...}
        jvmTest {...}
        androidMain {
            kotlin.srcDirs += jvmMain.kotlin.srcDirs // exclude **/*Backtick*?
       }
       androidTest {
            kotlin.srcDirs += jvmTest.kotlin.srcDirs // exclude **/*Backtick*?
       }
    }
    • 1
    • 1
  • m

    markusa

    07/13/2019, 9:35 AM
    I'm btw. currently moving Kluent from an old manual Gradle approach (supporting all platforms aside from native) to the multiplatform plugin, to get support for native in. If you're interested in having a look or share feedback: https://github.com/MarkusAmshove/Kluent/pull/148
    o
    • 2
    • 2
  • a

    altavir

    07/13/2019, 3:10 PM
    @udalov, I've hit a wall with https://youtrack.jetbrains.com/issue/KT-28927. In a single project it could be resolved by clean build, but in separate projects, I can't find a way to fix it. Is there a workaround until 1.3.50?
    u
    • 2
    • 3
  • s

    spierce7

    07/14/2019, 7:02 PM
    Is there a multiplatform Float or Double to String writer? I need a way to chop off the
    x.0
    at the end when there is no decimal data.
    g
    • 2
    • 1
  • j

    JoakimForslund

    07/15/2019, 7:53 AM
    Wanted to be able to directly run my jvm target in my Multiplatform setup. Using the following kotlin gradle script i'm trying to launch the
    Application.kt
    file placed inside my package called `box`:
    tasks.create("run", JavaExec::class) {
        dependsOn("jvmMainClasses", "jvmJar")
        main = "box.ApplicationKt"
        classpath = files(
            kotlin.targets["jvm"].compilations["main"].output.allOutputs.files,
            configurations["jvmRuntimeClasspath"]
        )
        args = listOf()
    }
    However, this results in :
    Error: Could not find or load main class box.ApplicationKt
    Anyone have any pointers to run a jvm target?
    g
    • 2
    • 6
  • a

    addamsson

    07/15/2019, 1:24 PM
    I'm working on some code in a
    common
    module (
    commonMain
    ) and I have my tests in
    commonTest
    . When I run my tests with Coverage in IDEA I get
    No coverage results
    . How can I configure IDEA to do Coverage for
    common
    code?
    a
    • 2
    • 3
  • k

    kpgalligan

    07/15/2019, 10:02 PM
    Working on client leads. Have some questions for the folks out there using KMP in production (for native mobile)
    n
    j
    • 3
    • 9
  • n

    Nikolai

    07/16/2019, 12:46 AM
    Hi, everyone I have a question about multiplatform project structure. In IDEA we have two main patterns mobile shared library and mobile android/ios. For library I understand it. We have app.framework for iOS and jar file for android. As for Mobile Android/iOS pattern I don't have clear picture. We still have framework for iOS, but how common module code applied to android? I saw in build.gradle that we use task
    kotlin {
        android("android")
        ....
    }
    But I don't understand what exactly it doing, what means "android" as parameter, what we have as output? And as result how common module code goes to android part? P.S. Also, is where any place I can found docs to understand that closures have this plugin (kotlin-multiplatform), plugin tasks, what they do and how they works?
    r
    k
    • 3
    • 12
  • r

    ribesg

    07/16/2019, 8:55 AM
    I’ve been publishing both
    -android
    and
    -android-debug
    variants of my kmp libs until now because I never managed to force a kmp library B to use the kmp library A’s
    -android
    release in its
    -android-debug
    build. Now I’m making another lib and I feel like I should stop publishing debug builds. Anyone encounter this problem and worked around it?
    r
    • 2
    • 3
  • d

    darkmoon_uk

    07/16/2019, 8:55 AM
    Here's an up-to-date :kotlin:*Multi-Platform Template* for all: https://github.com/chris-hatton/kotlin-multiplatform-template Using newest Multi-Platform plugin to compile for: ⚙️ Ktor-based Server :android: Android Mobile/Tablet 📺 Android TV 🍏 iOS Mobile/Tablet :java: JavaFX Desktop MVP Architecture is favoured 👌 Coroutines and Serialization are set-up ✅ Shared library exists between Server and Client to share Models 🤝 Another shared library across Clients to share Presenters 💁‍♂️ Android has a final shared library for Views between Mobile & TV I would like to add an experimental Kotlin/WASM client soon. All welcome to fork/use, and especially welcome to suggest improvements ❗🙂
    👍 4
    r
    r
    • 3
    • 3
  • d

    Dmitry Motyl

    07/16/2019, 12:18 PM
    Guys, where is the difference between
    ./gradlew android:build
    via terminal and
    build
    via Android Studio? I get exception
    e: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    if I build via terminal..
    g
    • 2
    • 3
  • a

    alex.hart

    07/16/2019, 4:58 PM
    Come up with a ‘PreferenceStore’ interface, and then have an Android impl (Using SharedPreferences) and an iOS impl (using UserDefaults). Then wherever you need it, just accept it as an argument, and let dependency injection do the rest.
    k
    r
    +4
    • 7
    • 8
  • m

    Michał Kalinowski

    07/17/2019, 7:56 PM
    such error appear
    -.txt
    d
    a
    • 3
    • 11
  • c

    ciriti

    07/18/2019, 9:52 AM
    Morning guys! Currently, I'm receiving the following error after the updating to Kotlin 1.3.40, does anyone have the same issue?
    d
    j
    +2
    • 5
    • 20
  • r

    russhwolf

    07/18/2019, 4:47 PM
    If I understand correctly, https://youtrack.jetbrains.com/issue/KT-20427 would let you do what you want
    l
    • 2
    • 7
  • j

    Jan Stoltman

    07/19/2019, 12:10 AM
    Hey guys, is there any multiplatform logging library for Android/iOS out there? @kpgalligan has mentioned that he has a K/N version of Timber in his droidcon SF 2018 talk iirc, is it out somewhere?
    j
    k
    +4
    • 7
    • 24
  • a

    altavir

    07/19/2019, 7:50 AM
    Do anybody have a build sample with new mpp with webpack bundle?
    s
    • 2
    • 26
  • s

    Sergioedcigreja

    07/19/2019, 9:36 AM

    https://files.slack.com/files-pri/T09229ZC6-FLD9BHUTB/captura_de_ecra___2019-07-19__a__s_09.11.01.png▾

    Good morning guys, I'm having this error on the iOS build since I have started using SQLDelight. I think it's because of when I added the classpath to the project build.gradle file, it asked me to remove the version of kotlin-multiplatform on the plugins task in the lib build.gradle. Maybe there are conflicting libraries?
    c
    • 2
    • 2
  • n

    Nicholas Bilyk

    07/20/2019, 2:53 PM
    Saturday morning troubles! I am publishing multi-platform libraries using the maven-publish plugin. It's set up in the default way that the kotlin multiplatform plugin configures the publishing. Everything is working as expected except that when I set them as dependencies, the source isn't included in IDEA. Source jars are being created properly, but the IDEA project structure doesn't see them. Any tips?
    r
    • 2
    • 3
  • m

    mbonnin

    07/21/2019, 12:34 PM
    What's the correct plugin to use in an Android module that uses other multiplatform modules ? https://github.com/Kotlin/mpp-example/blob/master/androidApp/build.gradle#L3 has
    org.jetbrains.kotlin.multiplatform
    and https://github.com/chris-hatton/kotlin-multiplatform-template/blob/master/Code/Client/Android/mobile/build.gradle.kts#L17 has
    kotlin-android
    d
    s
    +3
    • 6
    • 68
Powered by Linen
Title
m

mbonnin

07/21/2019, 12:34 PM
What's the correct plugin to use in an Android module that uses other multiplatform modules ? https://github.com/Kotlin/mpp-example/blob/master/androidApp/build.gradle#L3 has
org.jetbrains.kotlin.multiplatform
and https://github.com/chris-hatton/kotlin-multiplatform-template/blob/master/Code/Client/Android/mobile/build.gradle.kts#L17 has
kotlin-android
Asking because I have a hard time having intelliJ picking up the multiplatform dependencies in my android app module (compilation works fine)
d

Dominaezzz

07/21/2019, 12:52 PM
Ha, was doing this yesterday. If you need to use both, use the multiplatform one.
m

mbonnin

07/21/2019, 12:57 PM
Does auto-complete work for you ? Some modules I can Ctrl-click into, other just stay red forever no matter how many times I gradle sync...
d

Dominaezzz

07/21/2019, 12:58 PM
It does.
Try re-importing the project.
m

mbonnin

07/21/2019, 1:00 PM
Yes, I've done that a few times... Right now I'm trying https://github.com/chris-hatton/kotlin-multiplatform-template but still got everything red (it's actually worse as intelliJ doesn't even pick up the androidx libs...) What intelliJ are you using ? (I'm using 2019.1 community)
d

Dominaezzz

07/21/2019, 1:02 PM
Same but Ultimate.
Is all of the source red or just some?
m

mbonnin

07/21/2019, 1:03 PM
d

Dominaezzz

07/21/2019, 1:03 PM
Ah, off course.
Had the same issue.
Show me your gradle sync output.
It's the dependency resolution issue you're talking about.
m

mbonnin

07/21/2019, 1:05 PM
Is that the sync output ? https://gist.github.com/martinbonnin/98ec2315474401e864ff1abad6d99ccc
:yes: 1
That doesn't mention much...
multiplatform projects are resolved by the IDE but Ctrl-click opens the decompiled class (and not the commonMain source file I would expect)
d

Dominaezzz

07/21/2019, 1:11 PM
Have you added
jcentre()
to your
repositories
block?
m

mbonnin

07/21/2019, 1:12 PM
It happens to be there (https://github.com/chris-hatton/kotlin-multiplatform-template/blob/96b78ed2237c7052c34b3ffe00ed3b573954732c/Code/Client/Android/build.gradle.kts#L33). But this is litteraly a clean checkout from the template project so I would expect it to work out of the box
Unless @darkmoon_uk does'nt have autocomplete either ?
s

Sergioedcigreja

07/21/2019, 1:14 PM
have you modified the sdk.dir on local.properties?
m

mbonnin

07/21/2019, 1:14 PM
yep, I have actually created local.properties, it wouldn't compile else
d

Dominaezzz

07/21/2019, 1:18 PM
Compiles? So you can run the project via the IDE?
m

mbonnin

07/21/2019, 1:18 PM
Yep
Everything compiles fine, it's just the IDE auto-complete that's messed up
d

Dominaezzz

07/21/2019, 1:21 PM
I don't see the androidx dependencies.
Nvm, found them
In the gradle window, try clicking the Refresh dependencies button.
m

mbonnin

07/21/2019, 1:24 PM
I have a "Refresh all Gradle project, is this it ?"
d

Dominaezzz

07/21/2019, 1:24 PM
No, there's another one.
m

mbonnin

07/21/2019, 1:25 PM
ah
Can't find it...
d

Dominaezzz

07/21/2019, 1:26 PM
Right-click
m

mbonnin

07/21/2019, 1:26 PM
Yay, thanks !
What does that do ? re-download dependencies ?
l

louiscad

07/21/2019, 1:27 PM
It seems there's a problem with a dependency (according to the red underline). Trying to build from command line should show the problem with dependency resolution if there's one.
d

Dominaezzz

07/21/2019, 1:27 PM
Hmm, I'm not completely sure but it usually forces IntelliJ to reindex stuff an the end.
m

mbonnin

07/21/2019, 1:28 PM
So now I have androix resolved but
client-common
is all red now (it used to link to the decompiled class file)
@louiscad building is perfectly fine, it's just the IDE features not recognizing all the dependencies
l

louiscad

07/21/2019, 1:33 PM
@mbonnin Are the red classes from an
android
or a
jvm
target, or from a non Kotlin multiplatform module (and if so, android or jvm?)
m

mbonnin

07/21/2019, 1:35 PM
I believe they are from a
commonMain
sourceSet that is included as a jvm() artifact (does that make sense ?)
FirstPresenterContract
usages for an example are all red until I build and gradle sync. Then usages are not red anymore but Ctrl-click opens the .jar and not the source file. https://github.com/chris-hatton/kotlin-multiplatform-template/blob/121ef4fa3129d506245e4f5ca9b0ceb29e02f773/Code/Client/Common/src/commonMain/kotlin/org/chrishatton/example/ui/contract/FirstPresenterContract.kt#L4-L3
d

Dominaezzz

07/21/2019, 1:40 PM
Hmm, it's frustrating that the project builds. Is
client-common
itself red?
m

mbonnin

07/21/2019, 1:42 PM
Now that I built, red has disappeared but IDE features like Ctrl-click still don't work. The IDE looks up the symbols inside the jar and isn't able to understand that they actually come from a source module
Maybe I'll just try a free trial of the ultimate edition, never know...
l

louiscad

07/21/2019, 1:46 PM
Android Studio has a decompiler too, but that doesn't work well for non java sources, especially when you start using features like coroutines and things that Java can't express
Android Studio uses parts of Ultimate features, plus parts of CLion, which is paid by us through Google if I understood the business model well
m

mbonnin

07/21/2019, 1:47 PM
The thing is I don't care about the decompiler, I just want Android Studio, intelliJ, idea, ... to recognize that these source are in my project in an included module
l

louiscad

07/21/2019, 1:48 PM
But that won't solve your issue. I think you should report the issue on kotl.in/issue, ideally with a reproducing project. This should just work, that's the developer UX we aim for
👍 1
m

mbonnin

07/21/2019, 1:49 PM
But if it works for everyone else, it's going to be though to reproduce...
l

louiscad

07/21/2019, 1:56 PM
It doesn't always work well for me when I mix jvm and android targets. I reported an issue a while ago with different symptoms, but it got crowded as there was regressions then partial fixes. A fresh one with a narrow scope will always help. In my company's project, I use only
android
targets for now because of these kind of issues. I planned to try 1.3.50 EAPs on a personal project after I make a release with 1.3.40 soon, so I can see what improved and open new issues for the remaining issues I encounter. I'm also rounding the corners of a project template that bundles modules templates to generate modularized bug reproducers by reproducing the modules w/ targets and dependency graph, and generate other projects more quickly. I didn't encounter the behavior you describe, so I still strongly encourage you to report it. If you want me to help generate a reproducing project, feel free to reach me here or by DM, my modules templates + (Kotlin) script already work well, I finished
settings.gradle.kts
auto-editing last nigh.
m

mbonnin

07/21/2019, 1:59 PM
Ah, thanks for the jvm vs android thing, that might help. In this case, the reproducer is quite easy thanks to Chris: https://github.com/chris-hatton/kotlin-multiplatform-template
BTW, same thing with ultimate edition
https://youtrack.jetbrains.com/issue/KT-32814?project=kt
👍 4
l

louiscad

07/21/2019, 2:23 PM
Perfect! Voted for it
👍 1
m

mbonnin

07/22/2019, 10:06 PM
I ended up targetting android for all the modules and now everything's working fine. Here's the commit if you're curious: https://github.com/HearthSim/Arcane-Tracker/commit/2d652d678bdfd26e8eca779f9fd697e178c18ff6. It's a bit tedious to have to maintain all these AndroidManifest, etc...
d

darkmoon_uk

07/22/2019, 10:19 PM
Upvoted as this affects the template; thanks for raising the issue @mbonnin!
👍 1
l

louiscad

07/22/2019, 10:29 PM
Note that you can use
stdlib-jdk7
on Android. Maybe even
stdlib-jdk8
since D8 in AGP 3.4+? Can you confirm @jw Also, do you know if it automatically raises the Kotlin jvmTarget to 8, and if you need to set compileOptions for AGP for it to work properly?
j

jw

07/22/2019, 10:39 PM
It has nothing to do with desugaring. It's more about types and APIs which you're already protected against by lint. Every Android dev should be using jdk8 stdlib and it's orthogonal to bytecode level (although I suspect the jdk8 one might target 8 which will force it on you)
m

mbonnin

07/22/2019, 10:52 PM
What do I get by using
stdlib-jdk8
instead of the plain
stdlib
?
j

jw

07/23/2019, 12:44 AM
Not much. You won't use anything from it. 7 is where the suppressed exception support lives which you want. But you might as well use 8
👍 2
d

darkmoon_uk

07/23/2019, 8:51 AM
@mbonnin On the subject of my usage of the
kotlin-android
plugin instead of the
kotlin-multiplatform
plugin at the top-level; this was a considered choice. Considerations being: • Firstly, I would expect either
kotlin-android
or
kotlin-multiplatform
(with Android target) to ultimately work. • While there seems to be a perception that the multi-platform plugin is 'recommended'; I wasn't able to find any suggestion that the platform-specific plugins are deprecated in any way - they still have their place and are valid for use. • Creating an all-in-one multiplatform client project for the clients I wanted to support is currently problematic for the
multiplatform
plugin. Specifically: to include a JavaFX Desktop client would mean the
android
and
java
plugins both need to be instated, but they are currently mutually exclusive in the same Gradle file. • Anyway, the amount of configuration I have (or may want to expand to) would become too cluttered and disorganised in a single file. I feel that
multiplatform
driven projects are better suited to libraries and do not cater well to top-level application projects where there is a lot of extra configuration going on. • In summary: the Android client project in my template should be only ever target the Android platform - so
kotlin-android
is the best fit • Finally: My supporting library projects are
kotlin-multiplatform
- as the best fit for them
m

mbonnin

07/23/2019, 8:54 AM
Makes sense, thanks !
d

darkmoon_uk

08/12/2019, 12:41 AM
Added a follow up the issue of IntelliJ breaking when jvm/android targets are mixed, at: https://youtrack.jetbrains.com/issue/KT-32814
Looks related to (maybe even a duplicate of) https://youtrack.jetbrains.com/issue/KT-30510 ...which comment says should be fixed in AS 3.6 Canary 6.
👍 1
View count: 4