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
gradle
  • l

    Luke

    03/03/2023, 2:25 PM
    Is there no way to get a project property defined in gradle.properties without declaring a variable? I want to access a property but I only use the value once. I would like to get the value inline if possible but the docs seem to only use delegates
    b
    • 2
    • 3
  • t

    tad

    03/03/2023, 7:39 PM
    Does
    kotlin-tooling-metadata.json
    matter for dependencies of an MPP project with only JVM/Android targets?
  • a

    afezeria

    03/04/2023, 10:35 AM
    The kt version of gradle 8 has been upgraded to 1.8, but why can't use the context receiver syntax in kts
    e
    • 2
    • 3
  • s

    sdeleuze

    03/04/2023, 2:08 PM
    I shared a proposal to introduce a Kotlin DSL idiomatic API that would be a subset of the current one, in order to reduce the complexity and the huge API surface currently exposed with many ways to do the same thing. That could allow to provide a much better DevXP without breaking Groovy DSL and the Gradle ecosystem. Please vote for https://github.com/gradle/gradle/issues/24154 if you think that makes sense.
    w
    • 2
    • 3
  • m

    Matt Nelson

    03/05/2023, 9:06 AM
    Have a kotlin multiplatform library I want to publish, but would like consumers to express capabilities when consuming so that they don't get a shit ton of unnecessary transitive dependencies. Something like Rust's
    features
    expression where consumers opt-in to a feature and the build system handles it. Anyone know how I might best achieve this?
    m
    v
    • 3
    • 10
  • h

    hisham bin awiad

    03/05/2023, 9:33 AM
    any one can help me with this issue : i updated all activities on manifest to android:exported=true but is still not fixed
    Installation failed due to: 'Failed to commit install session 169461024 with command package install-commit 169461024. Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl169461024.tmp/base.apk (at Binary XML file line #139): com.common.broadcast.NetworkBroadCastReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'
    s
    • 2
    • 3
  • n

    nkiesel

    03/09/2023, 1:18 AM
    I have a pure Kotlin project with a few external dependencies. I thought IntelliJ dependency tool window would allow me to find updates to them. However, while it shows all of them, clicking on the version number drop-down only shows the current version, even if newer stable versions are available. Any idea what I'm doing wrong?
    v
    p
    t
    • 4
    • 4
  • p

    Pablo

    03/10/2023, 7:43 AM
    Hello, is the correct channel to ask about
    Gradle Managed Devices
    ? I'm having some issues while running the
    Espresso
    tests
    k
    v
    • 3
    • 4
  • m

    Marcus Cvjeticanin

    03/10/2023, 4:27 PM
    Hi, I'm trying to prepare my Kotlin project (ofc using Kotlin DSL with Gradel) to publish on Maven Central. However that is not my question. My question is that, if I have some plugins or other general build tool configuration that I want all other subprojects to inherit. Can I in my root build.gradle.kts define it and all other projects will get the same config? In my root, I have settings.gradle.kts:
    include ("library-dir")
    Will all of the includes get this? Or how can I do this if not? I just want to avoid writing the same config on several places. Follow-up question regarding the publishing part: • Should I have different versions of the libraries of my SDK? I saw that for example Ktor has the same versions for all libraries since they use a variable to define as
    $ktor_version
    implementation("io.ktor:ktor-client-core:$ktor_version")
    implementation("io.ktor:ktor-client-cio:$ktor_version")
    c
    • 2
    • 3
  • r

    Rasmus

    03/11/2023, 10:10 AM
    I noticed that there's no built in way to copy test resources from one submodule to a submodule that depends on it. What is the recommended way to include this file:
    core/src/test/resources/logback-test.xml
    ? To the relevant build directory of all of these submodules that depend on the core module:
    submodule1/build/resources/test
    submodule2/build/resources/test
    ...
    v
    v
    • 3
    • 7
  • a

    Adam S

    03/11/2023, 12:47 PM
    is there a Kotlin Multiplatform equivalent for the Java Test Fixtures plugin? I want to share test helpers between subprojects, per target platform (so there would be jvmTestFixtures, jsTestFixtures, etc).
    v
    e
    v
    • 4
    • 16
  • p

    PHondogo

    03/13/2023, 5:41 AM
    Hello! Is it possible to remove common dependency from target of Gradle Kotlin multiplatform project?
    b
    • 2
    • 1
  • a

    Adrian Witaszak

    03/14/2023, 3:03 PM
    Hi. Is it possible to add multiple sourceSets for android and ios? Currently, i've got android and ios which are used by native apps, and react bridge in separate module. I wonder if I can add android("reactNative") and ios("reactNative") sourceSets to KMM module and keep react native-related stuff in there, like, for example, the React Native bridge?
    a
    • 2
    • 2
  • a

    Adrian Witaszak

    03/14/2023, 5:38 PM
    When we import other modules, there is an optional configuration in the project. How do i receive this configuration String in other module?
    implementation(project(path = ":AnyModule", configuration = null))
    v
    • 2
    • 1
  • c

    CLOVIS

    03/14/2023, 9:44 PM
    I want to create convention plugins to simplify my build. However, I have projects that use either
    kotlin("jvm")
    ,
    kotlin("js")
    or
    kotlin("multiplatform")
    . Is it possible to create a convention plugin that configures all of them? I don't want to create one plugin per Kotlin plugin…
    m
    v
    t
    • 4
    • 39
  • c

    CLOVIS

    03/16/2023, 6:56 PM
    Does anyone know what the Android plugin maven coordinates are? In convention plugins, we're supposed not to use the plugin ID
    h
    d
    • 3
    • 7
  • c

    CLOVIS

    03/16/2023, 8:07 PM
    I'm getting when applying the Kotlin Multiplatform plugin as well as the Android library plugin…
    Could not create an instance of type org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget.
    > Could not generate a decorated class for type KotlinAndroidTarget.
       > com/android/build/gradle/api/BaseVariant
    The error message doesn't help me at all, where should I look for to fix this?
    m
    • 2
    • 19
  • h

    Humphrey

    03/17/2023, 6:22 AM
    Is there any example on how to use gradle version catalog toml where the BOM of spring boot is defined as platform so I don’t need to specify any version of the dependencies that is already provided by that BOM? And how do I override/pin just one version let’s say for the H2 database (com.h2databsse) to an older version? And add additional dependencies that are not there in the spring boot BOM?
    v
    c
    • 3
    • 8
  • h

    helpermethod

    03/17/2023, 7:29 AM
    Hi! When using Kotlin with Gradle, should I define
    java.toolchain
    or
    kotlin.toolchain
    in my
    build.gradle.kts
    or both? What is the difference between the two?
    p
    v
    t
    • 4
    • 7
  • g

    Gleb Minaev

    03/18/2023, 11:11 AM
    Is there a way to mark custom Kotlin source set as a "test source set" in IDEA via Gradle? I know that there is a way to mark standard Gradle source set (via
    idea { module { testSources.from(<path to the source directory>) } }
    ). But Kotlin source sets are not standard Gradle source set... (Here is the use case.) I have a project with separate benchmarks source set. (Which is used in kotlinx.benchmark.) And benchmark tasks are marked as test ones. But the source set is not. So I want to "fix" the difference.
    a
    • 2
    • 6
  • c

    CLOVIS

    03/18/2023, 1:27 PM
    How can I specify a BOM in a multiplatform project?
    kotlin {
        jvm()
        android()
    
        sourceSets {
            val androidMain by getting {
                dependencies {
                    implementation(platform(libs.androidx.compose.bom)) // Unresolved reference: platform
                    implementation(libs.androidx.compose.material3)
                }
            }
        }
    }
    e
    a
    • 3
    • 23
  • m

    Mustafa Ozhan

    03/20/2023, 1:31 PM
    is it possible to reach
    libs
    from
    gradle/libs.versions.toml
    in pre-compiled scripts located in
    buildScr/src/main/kotlin
    ?
    c
    a
    +3
    • 6
    • 56
  • b

    breandan

    03/21/2023, 4:56 AM
    Happy to see that the old Groovy property assignment syntax is now (experimentally) supported! https://docs.gradle.org/8.1-rc-1/release-notes.html#experimental-simple-property-assignment-in-kotlin-dsl-scripts FTR, I reported this issue almost six years ago (proper support for array assignment
    property = [...]
    depends on collection literals): https://github.com/gradle/kotlin-dsl-samples/issues/324 Also related: https://github.com/gradle/kotlin-dsl-samples/issues/712
  • z

    Zac Sweers

    03/21/2023, 5:07 AM
    I kinda think it's an awful idea to try to make kotlin look like groovy. Many of Gradle's papercuts are because of ambiguous groovy syntax leading to unexpected code paths
    v
    m
    +5
    • 8
    • 31
  • h

    hfhbd

    03/21/2023, 1:36 PM
    Is there any good documentation about the kotlin mpp gradle plugin for Gradle plugin authors? How to get the targets, the sourcesets and the tasks per target, ideally all lazy? And btw what's the use-case for creating
    ObserableSet
    and not using
    NamedDomainObjectSet
    ? 🤔
    j
    t
    • 3
    • 2
  • t

    Tianyu Zhu

    03/21/2023, 7:56 PM
    I have a Kotlin Multiplatform project that uses Kotlin/JS and Kotlin/JVM. Here's a short version of my
    build.gradle.kts
    plugins {
      kotlin("multiplatform")
      application
    }
    
    application {
      mainClass.set("path.to.my.MainKt")
    }
    
    kotlin {
      js()
      jvm()
    }
    I'd like to use
    gradlew run
    to run the
    path.to.my.MainKt
    file, but the
    run
    task doesn't want to use the runtime classpath in
    jvmMain
    . How do I fix this problem?
    e
    • 2
    • 4
  • h

    Humphrey

    03/22/2023, 4:07 PM
    How to add Jacoco plugin to TOML version catalog file Instead of
    id("jacoco")
    in the plugins section of build.gradle I would like to use
    alias(libs.plugins.jacoco)
    e
    c
    v
    • 4
    • 26
  • x

    xxfast

    03/23/2023, 10:39 AM
    Hi all - i have a kotlin multiplatform project with multiple modules
    // module-1 build.gradle.kts
    plugin {
      kotlin("multiplatform")
    }
    
    // module-2 build.gradle.kts
    plugin {
      kotlin("jvm")
    }
    
    // module-3 build.gradle.kts
    plugin {
      kotlin("js")
    }
    how do I enable
    explicitApi
    mode for
    allprojects{}
    of the root build.gradle.pks ?
    // root build.gradle.kts
    allprojects {
      extensions.configure<KotlinMultiplatformExtension> { explicitApi() } // Extension of type 'KotlinMultiplatformExtension' does not exist. 
    }
    t
    v
    • 3
    • 2
  • n

    Nigel Smith

    03/27/2023, 9:47 AM
    Investigating moving a large-ish multi-project monorepo from maven to Gradle -
    gradle init
    tries to convert but seems to miss the Kotlin plugin; picks up on some Java (mostly generated via Jooq) and creates only a
    java-conventions
    file (so never actually tries to compile any of the kotlin) - does anyone know what that tool looks for to pick up on Kotlin in the pom?
    v
    • 2
    • 5
  • d

    dave08

    03/28/2023, 7:50 AM
    Hi! I just updated a bunch of dependencies (and gradle from 7.1 to 8.0.2) on an older project and got this very cryptic error (posted in thread), googling didn't get any really helpful results...
    j
    t
    • 3
    • 6
Powered by Linen
Title
d

dave08

03/28/2023, 7:50 AM
Hi! I just updated a bunch of dependencies (and gradle from 7.1 to 8.0.2) on an older project and got this very cryptic error (posted in thread), googling didn't get any really helpful results...
Task :kaptGenerateStubsKotlin FAILED
e: java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type: ErrorScope{Error scope for class <Error class: unknown class> with arguments: org.jetbrains.kotlin.types.IndexedParametersSubstitution@15297228} [Error type: Unresolved type for Flow<T>] at org.jetbrains.kotlin.types.SimpleTypeImpl.<init>(KotlinTypeFactory.kt:230) at org.jetbrains.kotlin.types.KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(KotlinTypeFactory.kt:161) at org.jetbrains.kotlin.types.KotlinTypeFactory.simpleType(KotlinTypeFactory.kt:88)
j

Javier

03/28/2023, 8:12 AM
Looks like an issue with ksp, not Gradle. Are you using compatible Kotlin and KSP versions?
d

dave08

03/28/2023, 8:58 AM
Nope, in the end it was bad imports (I upgraded from an old coroutines library...). But the error was in Kapt and not in the actual build... which is VERY weird...
j

Javier

03/28/2023, 10:02 AM
Oh yeah, I was thinking on ksp but it is a kapt task. Maybe an old cached file that is not deleted?
d

dave08

03/28/2023, 11:08 AM
Nope... I did all the Fix IDE steps...
t

tapchicoma

03/28/2023, 3:56 PM
Could you create a Kotlin issue with repro?
View count: 4