Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions workmanager_android/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ rootProject.allprojects {
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
// AGP 9+ has built-in Kotlin support; older versions need the plugin explicitly.
def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int
if (agpMajor < 9) {
apply plugin: 'kotlin-android'
}

android {
// Conditional for compatibility with AGP <4.2.
Expand All @@ -34,12 +38,13 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "1.8"
if (agpMajor < 9) {
kotlinOptions {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "1.8"
}
}
}

}

dependencies {
Expand Down
Loading