diff --git a/packages/react-native-executorch-webrtc/android/build.gradle b/packages/react-native-executorch-webrtc/android/build.gradle index 919f9d2666..8a65360122 100644 --- a/packages/react-native-executorch-webrtc/android/build.gradle +++ b/packages/react-native-executorch-webrtc/android/build.gradle @@ -13,7 +13,13 @@ buildscript { } 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' +} android { namespace 'com.executorch.webrtc' diff --git a/packages/react-native-executorch/android/build.gradle b/packages/react-native-executorch/android/build.gradle index be4a2f5373..f36b80e302 100644 --- a/packages/react-native-executorch/android/build.gradle +++ b/packages/react-native-executorch/android/build.gradle @@ -34,7 +34,14 @@ def reactNativeArchitectures() { } 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: "com.facebook.react"