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
20 changes: 15 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ allprojects {
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

// AGP 9 ships Kotlin support built in and fails the build if the Kotlin
// Gradle Plugin is applied on top of it. Keep applying it for AGP 8 so this
// module still builds on older toolchains.
def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int
if (agpMajor < 9) {
apply plugin: "kotlin-android"
}

android {
namespace = "io.github.zeshuaro.google_api_headers"
Expand All @@ -34,10 +41,6 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
}

sourceSets {
main.java.srcDirs += "src/main/kotlin"
test.java.srcDirs += "src/test/kotlin"
Expand All @@ -64,3 +67,10 @@ android {
}
}
}

// Replaces the removed `android.kotlinOptions`; works under both toolchains.
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
}
}