From 240b6fd606fdd4da0cae3715275422c108f89541 Mon Sep 17 00:00:00 2001 From: ibaker Date: Wed, 10 Jul 2024 10:18:18 -0700 Subject: [PATCH] Fix 'duplicate class' error caused by incomplete kt stdlib metadata When testing locally it seemed that upgrading KGP to `1.9.20` resolved this, but testing again confirms this was incorrect, so the problem was reintroduced in https://github.com/androidx/media/commit/00d1e70a346f542d849253b72b52cf0b638845fd. This change reverts back to KGP `1.9.0` (since upgrading didn't help) and instead implements the workaround suggested in https://issuetracker.google.com/278545487. The workaround is now in the `lib-common` `build.gradle` file, which is transitively depended on by all modules (and therefore all apps that use this library), so there's no need for any developer action, and so the release note is removed. Issue: androidx/media#1262 PiperOrigin-RevId: 651066418 --- RELEASENOTES.md | 9 --------- build.gradle | 2 +- libraries/common/build.gradle | 5 +++++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 7d60c59e54..fc07da972f 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -11,15 +11,6 @@ * Add override for `SimpleBasePlayer.State.Builder.setPlaylist()` to directly specify a `Timeline` and current `Tracks` and `Metadata` instead of building a playlist structure. - * Upgrade `androidx.annotation:annotation` dependency to `1.6.0`. This may - cause `duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations` - and similar errors for non-Kotlin apps that also depend on other libs - like `androidx.appcompat:appcompat`. This is due to - [incomplete version constraints in the Kotlin standard library](https://youtrack.jetbrains.com/issue/KT-55297). - Apps can resolve this by upgrading their - [Kotlin Gradle Plugin](https://kotlinlang.org/docs/gradle-configure-project.html#apply-the-plugin) - to at least version `1.9.20` or using the workaround described in - https://issuetracker.google.com/278545487. * ExoPlayer: * `MediaCodecRenderer.onProcessedStreamChange()` can now be called for every media item. Previously it was not called for the first one. Use diff --git a/build.gradle b/build.gradle index 35eaa58d3f..c3243831df 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:8.3.2' classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.4' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0' } } allprojects { diff --git a/libraries/common/build.gradle b/libraries/common/build.gradle index 8b0c9fe227..71184f5da1 100644 --- a/libraries/common/build.gradle +++ b/libraries/common/build.gradle @@ -65,6 +65,11 @@ dependencies { } api 'androidx.annotation:annotation-experimental:' + androidxAnnotationExperimentalVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion + // Workaround for 'duplicate class' error caused by incomplete version + // metadata in Kotlin std lib (https://issuetracker.google.com/278545487). + // This can be removed when one of the other deps here (probably + // androidx.annotation) depends on kotlin-stdlib:1.9.20. + implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0') compileOnly 'com.google.code.findbugs:jsr305:' + jsr305Version compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion