Skip to content

Commit 0d08943

Browse files
committed
cleaning
1 parent 86cf6b6 commit 0d08943

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

packages/firebase_ai/firebase_ai/android/build.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ version '1.0-SNAPSHOT'
44
apply plugin: 'com.android.library'
55
apply from: file("local-config.gradle")
66

7+
// AGP 9+ has built-in Kotlin support; older versions need the plugin explicitly.
8+
def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int
9+
if (agpMajor < 9) {
10+
apply plugin: 'kotlin-android'
11+
}
12+
713
buildscript {
814
repositories {
915
google()
@@ -16,20 +22,25 @@ android {
1622
namespace 'io.flutter.plugins.firebase.ai'
1723
}
1824

19-
compileSdk project.ext.compileSdk
25+
compileSdkVersion project.ext.compileSdk
2026

2127
defaultConfig {
2228
minSdkVersion project.ext.minSdk
23-
targetSdkVersion project.ext.targetSdk
2429
}
2530

2631
compileOptions {
2732
sourceCompatibility project.ext.javaVersion
2833
targetCompatibility project.ext.javaVersion
2934
}
3035

31-
kotlinOptions {
32-
jvmTarget = project.ext.javaVersion
36+
if (agpMajor < 9) {
37+
kotlinOptions {
38+
jvmTarget = project.ext.javaVersion
39+
}
40+
}
41+
42+
sourceSets {
43+
main.java.srcDirs += "src/main/kotlin"
3344
}
3445

3546
lintOptions {

0 commit comments

Comments
 (0)