Skip to content
Closed
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
24 changes: 14 additions & 10 deletions packages/firebase_analytics/firebase_analytics/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'com.android.library'
apply from: file("local-config.gradle")

buildscript {
ext.kotlin_version = "1.8.22"
ext.kotlin_version = "2.2.20"
repositories {
google()
mavenCentral()
Expand All @@ -24,14 +24,24 @@ rootProject.allprojects {
}
}

apply plugin: 'com.android.library'

// 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) {
def builtInKotlin = providers.gradleProperty("android.builtInKotlin")
.map { it.toBoolean() }
.orElse(agpMajor >= 9)
.get()
if (agpMajor < 9 || !builtInKotlin) {
apply plugin: 'kotlin-android'
}

plugins.withId("org.jetbrains.kotlin.android") {
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
}

def firebaseCoreProject = findProject(':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 All @@ -58,12 +68,6 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

if (agpMajor < 9) {
kotlinOptions {
jvmTarget = project.ext.javaVersion
}
}

compileOptions {
sourceCompatibility project.ext.javaVersion
targetCompatibility project.ext.javaVersion
Expand Down
Loading