From c3313c0049c84f99e2a64bd70105ef1db845e802 Mon Sep 17 00:00:00 2001 From: jbibik Date: Thu, 15 Aug 2024 10:33:17 -0700 Subject: [PATCH] Add jvmTarget and kotlin-android plugin to common_ktx module According to https://kotlinlang.org/docs/gradle-configure-project.html#check-for-jvm-target-compatibility-of-related-compile-tasks and https://kotlinlang.org/docs/gradle-configure-project.html#what-can-go-wrong-if-targets-are-incompatible, we require explicit jvmTarget setting in order not to run into: `'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.` Missing the plugin and the jvmTarget resulted in a failed `compileDebugKotlin` task for any application code, which was trying to import common_ktx functions (e.g. `Player.listen` with `Unresolved reference: listen` error) PiperOrigin-RevId: 663358677 --- libraries/common_ktx/build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/common_ktx/build.gradle b/libraries/common_ktx/build.gradle index a3758f9475..ac51e954c6 100644 --- a/libraries/common_ktx/build.gradle +++ b/libraries/common_ktx/build.gradle @@ -13,7 +13,7 @@ // limitations under the License. apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle" - +apply plugin: 'kotlin-android' android { namespace 'androidx.media3.common.ktx' @@ -33,6 +33,10 @@ android { includeAndroidResources = true } } + + kotlinOptions { + jvmTarget = '1.8' + } } dependencies {