1+ buildscript {
2+ // Read the Kotlin version from the consuming app's rootProject.ext first (most RN apps
3+ // already set this for reanimated/gesture-handler/screens/etc.), falling back to a bundled
4+ // default only when nothing else in the build graph has declared one. We deliberately use
5+ // the classic `buildscript { classpath ... } + apply plugin` form here instead of the
6+ // `plugins { id(...) version(...) }` DSL: the latter hard-fails the whole consumer build with
7+ // "plugin already on the classpath with a different version" if any other subproject (e.g.
8+ // reanimated) applies a different Kotlin version, since it enforces exact version matches per
9+ // plugin id across the whole multi-project build. The classpath form just resolves to a
10+ // single version (highest wins) with no such conflict.
11+ //
12+ // Fallback version has no ecosystem anchor to track — it only applies when nothing else in
13+ // the host build declared a Kotlin version at all, which is already rare in the RN ecosystem.
14+ // Bump it opportunistically; nothing depends on it matching anything specific.
15+ def kotlinVersion = rootProject. ext. has(" kotlinVersion" ) ? rootProject. ext. get(" kotlinVersion" ) : " 1.9.24"
16+
17+ repositories {
18+ google()
19+ mavenCentral()
20+ }
21+ dependencies {
22+ classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion "
23+ }
24+ }
25+
126apply plugin : " com.android.library"
27+ apply plugin : " kotlin-android"
228
329def isNewArchitectureEnabled () {
430 // To opt-in for the New Architecture, you can either:
@@ -10,10 +36,16 @@ def isNewArchitectureEnabled() {
1036
1137def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
1238
13- def DEFAULT_COMPILE_SDK_VERSION = 26
14- def DEFAULT_BUILD_TOOLS_VERSION = " 26.0.3"
15- def DEFAULT_TARGET_SDK_VERSION = 26
16- def DEFAULT_MIN_SDK_VERSION = 16
39+ // These are fallbacks only — real consumer apps set compileSdkVersion/buildToolsVersion/
40+ // targetSdkVersion/minSdkVersion on rootProject themselves (RN's own template always has),
41+ // so bumping these defaults doesn't change behavior for any app that already does. Keep them
42+ // aligned with RN's current app template (verified against Examples/CodePushDemo's root
43+ // build.gradle, generated from RN 0.87's template) so a consumer relying on the fallback still
44+ // gets a build that actually works with a current RN version.
45+ def DEFAULT_COMPILE_SDK_VERSION = 35 // RN template: compileSdkVersion
46+ def DEFAULT_BUILD_TOOLS_VERSION = " 35.0.0" // RN template: buildToolsVersion
47+ def DEFAULT_TARGET_SDK_VERSION = 35 // RN template: targetSdkVersion
48+ def DEFAULT_MIN_SDK_VERSION = 24 // RN template: minSdkVersion (RN 0.74+'s own minimum)
1749
1850android {
1951 namespace " com.microsoft.codepush.react"
@@ -40,9 +72,25 @@ android {
4072 buildFeatures {
4173 buildConfig true
4274 }
75+
76+ // JVM 17 matches mise.toml's `java = "17"` pin (this repo's own toolchain) and RN 0.76+'s own
77+ // minimum required JDK — not an arbitrary choice. Confirmed against Examples/CodePushDemo:
78+ // its build resolves unit-test javac to JVM 17 regardless of what's set here, so this module
79+ // must match it or Kotlin's build fails with "Inconsistent JVM Target Compatibility". Bump
80+ // this in lockstep with mise.toml's java version, never independently.
81+ compileOptions {
82+ sourceCompatibility JavaVersion . VERSION_17
83+ targetCompatibility JavaVersion . VERSION_17
84+ }
85+
86+ kotlinOptions {
87+ jvmTarget = JavaVersion . VERSION_17 . toString()
88+ }
4389}
4490
4591dependencies {
4692 implementation ' com.facebook.react:react-android:0.82.1'
4793 implementation ' com.nimbusds:nimbus-jose-jwt:9.37.3'
94+
95+ testImplementation ' junit:junit:4.13.2'
4896}
0 commit comments