Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ apply plugin: 'com.android.library'
apply from: file("local-config.gradle")

buildscript {
ext.kotlin_version = "2.0.0"
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

rootProject.allprojects {
Expand All @@ -18,6 +22,16 @@ rootProject.allprojects {
}
}

// AGP 9+ has built-in Kotlin support unless Flutter opts out via android.builtInKotlin=false.
def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int
def builtInKotlin = providers.gradleProperty("android.builtInKotlin")
.map { it.toBoolean() }
.orElse(agpMajor >= 9)
.get()
if (agpMajor < 9 || !builtInKotlin) {
apply plugin: 'kotlin-android'
}

def firebaseCoreProject = rootProject.subprojects.find { it.name == "firebase_core" }
if (firebaseCoreProject == null) {
throw new GradleException('Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?')
Expand Down Expand Up @@ -49,6 +63,11 @@ android {
targetCompatibility project.ext.javaVersion
}

sourceSets {
main.java.srcDirs += "src/main/kotlin"
test.java.srcDirs += "src/test/kotlin"
}

buildFeatures {
buildConfig true
}
Expand All @@ -64,4 +83,12 @@ dependencies {
implementation 'androidx.annotation:annotation:1.7.0'
}

plugins.withId("org.jetbrains.kotlin.android") {
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(project.ext.javaVersion.toString())
}
}
}

apply from: file("./user-agent.gradle")

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading