Skip to content

Commit 31c2931

Browse files
committed
build: AGP 8.13.2 with R8 9.1.43 so D8 can read Kotlin 2.4 metadata
The Kotlin version moved to 2.4.10 while AGP stayed on 8.12.1, whose bundled R8 (8.12.14) predates Kotlin 2.4 metadata. Every dex step then logs "An error occurred when parsing kotlin metadata" once per Kotlin stdlib class, about a thousand lines per build. Kotlin 2.4 needs R8 9.1.29 or newer, which no 8.x AGP bundles, so R8 is pinned on the buildscript classpath the way the AGP/Kotlin compatibility docs describe, and AGP moves to the last 8.x release. Both are overridable per project like the existing versions.
1 parent 973cbfc commit 31c2931

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎test-app/build.gradle‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,18 @@ version of the {N} CLI install a previous version of the runtime package - 'tns
134134

135135
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "${ns_default_kotlin_version}" }
136136
def computeBuildToolsVersion = { -> project.hasProperty("androidBuildToolsVersion") ? androidBuildToolsVersion : "${NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION}" }
137+
def computeR8Version = { -> project.hasProperty("r8Version") ? r8Version : "${NS_DEFAULT_R8_VERSION}" }
137138
def kotlinVersion = computeKotlinVersion()
138139
def androidBuildToolsVersion = computeBuildToolsVersion()
140+
def r8Version = computeR8Version()
139141

140142
repositories {
141143
google()
142144
mavenCentral()
143145
}
144146
dependencies {
145147
classpath "com.android.tools.build:gradle:$androidBuildToolsVersion"
148+
classpath "com.android.tools:r8:$r8Version"
146149
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
147150
classpath "org.apache.groovy:groovy-all:4.0.21"
148151
}

‎test-app/gradle.properties‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ android.useAndroidX=true
2222
NS_DEFAULT_BUILD_TOOLS_VERSION=35.0.0
2323
NS_DEFAULT_COMPILE_SDK_VERSION=35
2424
NS_DEFAULT_MIN_SDK_VERSION=21
25-
NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION=8.12.1
25+
NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION=8.13.2
26+
# R8 8.x cannot read Kotlin 2.4 metadata (needs 9.1.29+), so the AGP-bundled R8 is overridden.
27+
NS_DEFAULT_R8_VERSION=9.1.43
2628

2729
ns_default_androidx_appcompat_version = 1.7.0
2830
ns_default_androidx_exifinterface_version = 1.3.7

0 commit comments

Comments
 (0)