Skip to content

Upgrade to Kotlin 2.3.0, AGP 9.0.0, and Gradle 9.2.1 to resolve metadata incompatibility#3

Merged
ageon1156 merged 3 commits into
mainfrom
copilot/fix-kotlin-metadata-incompatibility
Jan 22, 2026
Merged

Upgrade to Kotlin 2.3.0, AGP 9.0.0, and Gradle 9.2.1 to resolve metadata incompatibility#3
ageon1156 merged 3 commits into
mainfrom
copilot/fix-kotlin-metadata-incompatibility

Conversation

Copilot AI commented Jan 22, 2026

Copy link
Copy Markdown

Build was failing with Kotlin metadata version incompatibility: build-logic used Kotlin 1.9.25 while Room, Datadog, Hilt, and Compose plugins required Kotlin 2.x metadata (version 2.1.0 vs expected 1.9.0).

Version Updates

  • Kotlin: 1.9.25 → 2.3.0
  • AGP: 8.1.2 → 9.0.0
  • KSP: 1.9.25-1.0.20 → 2.3.4
  • Gradle: 8.5 → 9.2.1

Compose Compiler Migration

Replaced deprecated kotlinCompilerExtensionVersion with Kotlin 2.x Compose Compiler plugin:

// Before (Kotlin 1.9.x)
commonExtension.composeOptions {
    kotlinCompilerExtensionVersion = libs.version("compose-compiler")
}

// After (Kotlin 2.x)
apply(plugin = libs.plugin("compose-compiler").get().pluginId)
extensions.configure<ComposeCompilerGradlePluginExtension> {
    stabilityConfigurationFiles.add(
        isolated.rootProject.projectDirectory.file("compose_compiler_config.conf")
    )
}

Build Configuration

  • Removed buildscript classpath block in favor of modern plugin DSL
  • Added AndroidLintConventionPlugin for lint configuration
  • Simplified settings.gradle.kts plugin resolution (removed custom Android plugin mapping)
  • Updated build-logic/convention/build.gradle.kts to include compose-gradlePlugin dependency

All changes align with upstream meshtastic/Meshtastic-Android repository structure.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -XX:MaxMetaspaceSize=2g -XX:&#43;UseG1GC -XX:&#43;HeapDumpOnOutOfMemoryError --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx8g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.5-bin/5t9huq95ubn472n8rpzujfbqh/gradle-8.5/lib/gradle-launcher-8.5.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.5-bin/5t9huq95ubn472n8rpzujfbqh/gradle-8.5/lib/agents/gradle-instrumentation-agent-8.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon (dns block)
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=2g -XX:&#43;UseG1GC -XX:&#43;HeapDumpOnOutOfMemoryError -Xmx8g -Dfile.encoding=UTF-8 (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • jitpack.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -XX:MaxMetaspaceSize=2g -XX:&#43;UseG1GC -XX:&#43;HeapDumpOnOutOfMemoryError --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx8g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.5-bin/5t9huq95ubn472n8rpzujfbqh/gradle-8.5/lib/gradle-launcher-8.5.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.5-bin/5t9huq95ubn472n8rpzujfbqh/gradle-8.5/lib/agents/gradle-instrumentation-agent-8.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon (dns block)
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=2g -XX:&#43;UseG1GC -XX:&#43;HeapDumpOnOutOfMemoryError -Xmx8g -Dfile.encoding=UTF-8 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Problem

The build is failing with Kotlin metadata version incompatibility errors. The build-logic module uses Kotlin 1.9.25, but several Gradle plugins require Kotlin 2.x.

Build Error Summary

e: Module was compiled with an incompatible version of Kotlin. 
The binary version of its metadata is 2.1.0, expected version is 1.9.0.

Affected Plugins

  • androidx.room:room-gradle-plugin:2.8.4
  • com.datadoghq:dd-sdk-android-gradle-plugin:1.22.0
  • com.google.dagger:hilt-android-gradle-plugin:2.58
  • org.jetbrains.compose:compose-gradle-plugin:1.10.0
  • org.jetbrains.compose.hot-reload:hot-reload-gradle-plugin:1.0.0

Cascading Errors

Due to the metadata version mismatch, these additional errors occur:

  1. 5 type arguments expected for CommonExtension - AGP API changed in 9.x
  2. Unresolved reference: kotlinCompilerExtensionVersion - Compose plugin API change
  3. Unresolved reference: compileSdk, minSdk, defaultConfig - AGP extension APIs not resolved
  4. Unresolved reference: KotlinMultiplatformAndroidLibraryTarget, KotlinBaseExtension - Kotlin 2.x APIs
  5. The feature "enum entries" is only available since language version 1.9 - Kotlin 2.x feature usage

Solution Required

Update the versions in gradle/libs.versions.toml to match the upstream meshtastic/Meshtastic-Android repository:

Component Current Version Required Version
kotlin 1.9.25 2.1.0 or higher (check upstream for exact version)
agp 8.1.2 8.7.0 or higher (check upstream for exact version)
devtools-ksp 1.9.25-1.0.20 Version matching Kotlin 2.x

Additionally, review and update any build-logic Kotlin files that may need API changes to work with the newer versions:

  • build-logic/convention/src/main/kotlin/AndroidApplicationComposeConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/AndroidLibraryComposeConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/AnalyticsConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/AndroidCompose.kt
  • build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/AndroidInstrumentedTests.kt
  • build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/Graph.kt
  • build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt
  • build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/MeshtasticFlavor.kt

Reference

The upstream repository (meshtastic/Meshtastic-Android) has working versions. Sync the dependency versions from:
https://github.com/meshtastic/Meshtastic-Android/blob/main/gradle/libs.versions.toml

Acceptance Criteria

  • Build completes successfully with ./gradlew assembleDebug
  • All Kotlin metadata version errors are resolved
  • All unresolved reference errors in build-logic are fixed

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 22, 2026 04:25
…er plugin

Co-authored-by: ageon1156 <140043221+ageon1156@users.noreply.github.com>
…settings.gradle.kts

Co-authored-by: ageon1156 <140043221+ageon1156@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Kotlin metadata version incompatibility in build-logic module Upgrade to Kotlin 2.3.0, AGP 9.0.0, and Gradle 9.2.1 to resolve metadata incompatibility Jan 22, 2026
Copilot AI requested a review from ageon1156 January 22, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants