Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions packages/react-native-executorch-webrtc/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -51,9 +57,11 @@ android {
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}
// No `kotlinOptions` block: it comes from the Kotlin plugin, which is not
// applied on AGP 9, so referencing it there fails with "Could not find
// method kotlinOptions()". Both AGP 8 and AGP 9 take the Kotlin jvmTarget
// from `compileOptions` above; verified to emit Java 17 bytecode on
// AGP 8.13.2 and AGP 9.4.0.

packaging {
jniLibs {
Expand Down
18 changes: 14 additions & 4 deletions packages/react-native-executorch/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import groovy.json.JsonSlurper

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
// Kept on the classpath but not applied here: AGP 9 ships built-in Kotlin
// support and registers the `kotlin` extension itself, so applying the
// Kotlin plugin on top fails with "Cannot add extension with name
// 'kotlin'". Applied conditionally below instead.
id("org.jetbrains.kotlin.android") apply false
id("com.facebook.react")
}

if (project.extensions.findByName("kotlin") == null) {
apply(plugin = "org.jetbrains.kotlin.android")
}

/**
* Helper function to get variables from the root project (App level)
* or fall back to local project properties.
Expand Down Expand Up @@ -116,9 +124,11 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}
// No `kotlinOptions` block: its type-safe accessor is generated only when
// the Kotlin plugin is applied from the `plugins` block, which it no longer
// always is. Both AGP 8 and AGP 9 take the Kotlin jvmTarget from
// `compileOptions` above; verified to emit Java 17 bytecode on AGP 8.13.2
// and AGP 9.4.0.
}

repositories {
Expand Down