Skip to content

Commit 3c3826b

Browse files
fix(android): add Kotlin 2.0 compose compiler plugin support
- Add kotlinMajor version check - Conditionally apply compose-compiler plugin for Kotlin >= 2.0 - Matches stripe-react-native pattern exactly
1 parent 15915bc commit 3c3826b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/stripe_android/android/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ buildscript {
66
ext.stripe_version = '21.26.+'
77
ext.compose_version = '1.5.1'
88

9+
def kotlinMajor = kotlin_version.tokenize('\\.')[0].toInteger()
10+
911
repositories {
1012
google()
1113
mavenCentral()
@@ -14,6 +16,10 @@ buildscript {
1416
dependencies {
1517
classpath 'com.android.tools.build:gradle:8.1.3'
1618
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
19+
// only use compose-compiler plugin when Kotlin >= 2.0
20+
if (kotlinMajor >= 2) {
21+
classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlin_version"
22+
}
1723
}
1824
}
1925

@@ -24,8 +30,14 @@ rootProject.allprojects {
2430
}
2531
}
2632

33+
def kotlinMajor = kotlin_version.tokenize('\\.')[0].toInteger()
34+
2735
apply plugin: 'com.android.library'
2836
apply plugin: 'kotlin-android'
37+
// Only apply compose plugin if Kotlin >= 2.0
38+
if (kotlinMajor >= 2) {
39+
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
40+
}
2941

3042
android {
3143
namespace 'com.flutter.stripe'

0 commit comments

Comments
 (0)