https://kotlinlang.org logo
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
benchmarks
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
confetti
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
lincheck
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
Title
r

ribesg

02/15/2023, 2:57 PM
I'm updating my multi-module multiplatform (android/ios/jvm) project from Kotlin 1.7.22 / Gradle 7.5.1 to Kotlin 1.8.10 / Gradle 8.0 and have this issue:
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
Anyone encountered this? It's a lint task so it still builds, but it looks weird. (see logs in thread)
> Task :modules:files:lintAnalyzeDebug
e: /Users/ribesg/Projects/kommon/modules/date/build/.transforms/08dc39c7d0e8d2d4d8c22c2254b1913c/transformed/out/jars/classes.jar!/META-INF/date_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/ribesg/Projects/kommon/modules/logging/log/build/.transforms/cc069f0764751b886663312279ea1e3b/transformed/out/jars/classes.jar!/META-INF/log_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/ribesg/Projects/kommon/modules/parcel/build/.transforms/6655e5cdb87c32025ff3a339cf946e14/transformed/out/jars/classes.jar!/META-INF/parcel_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/ribesg/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.10/6d5560a229477df9406943d5feda5618e98eb64c/kotlin-stdlib-1.8.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/ribesg/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.10/6d5560a229477df9406943d5feda5618e98eb64c/kotlin-stdlib-1.8.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/ribesg/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.8.10/6d5560a229477df9406943d5feda5618e98eb64c/kotlin-stdlib-1.8.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/ribesg/Projects/kommon/modules/files/build/.transforms/8b50949d0fc02d8778ae67ffa6d0c0f3/transformed/out/jars/classes.jar!/META-INF/files_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/ribesg/Projects/kommon/modules/files/build/tmp/kotlin-classes/debug/META-INF/files_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
m

mbonnin

02/15/2023, 3:00 PM
expected version is 1.6.0
That's surprising. I would usually link to Gradle compiling with an older version of Kotlin but Gradle 8 should use Kotlin 1.8.10
r

ribesg

02/15/2023, 3:01 PM
Yes. I'm also using a version catalog with the kotlin version set to 1.8.10, used everywhere. To find outdated mentions of 1.7.22, why not, but 1.6.0?
m

mbonnin

02/15/2023, 3:02 PM
Could it be that
lintAnalyzeDebug
is calling the Kotlin compiler under the hood?
Does it show anything if you run with
-i
?
r

ribesg

02/15/2023, 3:05 PM
No, nothing more. Just a bunch of
Transforming X
lines. And this, then the errors I shared above and Build Success.
Caching disabled for task ':modules:files:lintAnalyzeDebug' because:
  Build cache is disabled
Task ':modules:files:lintAnalyzeDebug' is not up-to-date because:
  Task.upToDateWhen is false.
Android Lint: Reusing lint classloader 30.3.0
Android Lint: Disposing Uast application environment in lint classloader [30.3.0]
I tried cleaning a bunch of gradle caches with no luck
Adding this to my root
build.gradle.kts
file "fixes" it:
buildscript {
    dependencies.classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10")
}
But I shouldn't need that… Right? It actually doesn't fix anything, I just thought because it didn't show errors when running the task again without clean (which didn't actually run the task I guess)
m

mbonnin

02/15/2023, 3:28 PM
weird. where did you declare the KGP version else?
I mean it's either in
buildSrc
(or
build-logic
) dependencies or in your root
build.gradle.Kts
plugins {
  id("org.jetbrains.kotlin.android").version("1.8.10")
}
Or is it somewhere else?
r

ribesg

02/15/2023, 3:48 PM
In `buildSrc`'s
build.gradle.kts
I have this
dependencies {
    compileOnly(gradleKotlinDsl())
    implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
    implementation(libs.gradle.android)
    implementation(libs.gradle.kotlin)
}
Which references my version catalog
libs.versions.toml
which contains this
[versions]
…
android-gradle = "7.3.0"
gradle = "8.0"
kotlin = "1.8.10"
…
[libraries]
…
gradle-android = { module = "com.android.tools.build:gradle", version.ref = "android-gradle" }
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
…
m

mbonnin

02/15/2023, 3:50 PM
Interesting... Maybe it's
gradleKotlinDsl()
doing funky stuff?
r

ribesg

02/15/2023, 3:55 PM
Removed it, no change. Seems like this dependency wasn't even needed anymore
I was wrong, the dependency in the buildscript doesn't fix anything, I probably mistakenly ran the task without
--rerun
or
clean
and understood the lack of error logs as success
a

Adam S

02/15/2023, 4:07 PM
have you added the Kotlin BOM?
implementation(platform(kotlin("bom")))
r

ribesg

02/15/2023, 4:11 PM
Never heard of it, at which level would I put that?
a

Adam S

02/15/2023, 4:13 PM
anywhere that the Kotlin plugin is applied
plugins {
  kotlin("jvm")
}

dependencies {
  implementation(platform(kotlin("bom")))
}
Note that different Configurations (
implementation
,
testFixturesImplementation
,
androidInstrumentedTest
) might need to re-apply it.
you can also apply it without the
kotlin()
helper function (which automatically adds the Kotlin version)
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
m

mbonnin

02/15/2023, 4:15 PM
how would that solve anything?
a

Adam S

02/15/2023, 4:18 PM
my guess is that there’s a transitive dependency on an older Kotlin dependency being brought in by a plugin or another dependency, so the BOM would align it
m

mbonnin

02/15/2023, 4:19 PM
I'm really curious if it works. I always thought
expected version is 1.6.0
was coming from the compiler
mmmm unless it's
kotlinx.metadata
🤔
which lint could maybe depend on...
a

Adam S

02/15/2023, 4:23 PM
I made a mistake @ribesg - make sure to wrap it with
platform()
. I’ve updated my examples above.
m

mbonnin

02/15/2023, 4:29 PM
"expected version is" comes from kotlinx.metadata. So maybe it's using the 1.8.x compiler with an outdated
kotlinx.metadata
version
Which is still weird, I'd expect the compiler to depend on the same version of metadata
r

ribesg

02/15/2023, 4:32 PM
I don't see any change after adding that dependency in a lot of places. There are hundreds of places I defines dependencies… I tried to add it for every platform the module I'm testing with compiles to and all the modules listed in the logs, no change
a

Adam S

02/15/2023, 4:35 PM
try running
./gradlew  :modules:files:dependencies
and looking for any kotlin/kotlinx dependencies that aren’t 1.8.10
r

ribesg

02/15/2023, 5:45 PM
I have a lot of dependencies referencing Kotlin 1.7 but not 1.6
Every reference ends with the form
1.7.20 -> 1.8.10
which means it's actually replaced with the updated version iirc
d

doubov

03/15/2023, 8:56 PM
@ribesg did you figure out what the issue was? I'm getting a similar error
r

ribesg

03/15/2023, 8:57 PM
No. I'm just riding the warnings wave.
k

kenkyee

03/28/2023, 8:24 PM
Having the same error running tests on a lint module we have FWIW.
kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
and the jdk7/jdk8 versions of it show in the warnings too. They're all in the gradle cache for paths. I'm also not in a multiplatform project.
a

Arjun Kallapur

05/11/2023, 7:25 PM
Has anyone in this thread been able to fix the problem? I am running into a similar issue with the lint task failing on my Android project when trying to update from Kotlin 1.7.10 to 1.8.20
e: /root/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-parcelize-runtime/1.8.10/b0e9f707501a1d64e47aee02bfd7d963b8448fba/kotlin-parcelize-runtime-1.8.10.jar!/META-INF/parcelize-runtime.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
d

doubov

05/11/2023, 7:27 PM
./gradlew --version
what's your Kotlin version there?
a

Arjun Kallapur

05/11/2023, 7:30 PM
Hmm, that shows 1.5.31
d

doubov

05/11/2023, 7:35 PM
I think you should upgrade that
a

Arjun Kallapur

05/11/2023, 7:39 PM
Thank you for that! Is there a way to upgrade only the Kotlin version of the gradle wrapper? Or should I upgrade the gradle wrapper to achieve this?
d

doubov

05/11/2023, 7:39 PM
I'm not an expert at this, but I think upgrading the wrapper is probably the way to go
a

Arjun Kallapur

05/11/2023, 7:40 PM
Got it, thank you!