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
This commit is contained in:
jbibik 2024-08-15 10:33:17 -07:00 committed by Copybara-Service
parent 50708f8c37
commit c3313c0049

View File

@ -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 {