diff --git a/.changeset/agp9-built-in-kotlin.md b/.changeset/agp9-built-in-kotlin.md new file mode 100644 index 00000000..61c9221c --- /dev/null +++ b/.changeset/agp9-built-in-kotlin.md @@ -0,0 +1,5 @@ +--- +'react-native-bottom-tabs': patch +--- + +Fix Android build with AGP 9 built-in Kotlin: skip applying the `kotlin-android` plugin when AGP has already registered the `kotlin` extension diff --git a/packages/react-native-bottom-tabs/android/build.gradle b/packages/react-native-bottom-tabs/android/build.gradle index f0892bd0..77350168 100644 --- a/packages/react-native-bottom-tabs/android/build.gradle +++ b/packages/react-native-bottom-tabs/android/build.gradle @@ -19,7 +19,14 @@ def isNewArchitectureEnabled() { } apply plugin: "com.android.library" -apply plugin: "kotlin-android" +// AGP 9 ships built-in Kotlin support and registers the `kotlin` extension +// itself. Applying the Kotlin plugin on top of it fails configuration with +// "Cannot add extension with name 'kotlin'". Only apply it when nothing has +// registered that extension yet. +if (project.extensions.findByName('kotlin') == null) { + apply plugin: "kotlin-android" +} + apply plugin: "kotlin-kapt" if (isNewArchitectureEnabled()) {