Skip to content

Commit 5882d84

Browse files
abueideclaude
andcommitted
fix(e2e): make Android SDK versions match plugin defaults
Updated E2E example build.gradle files to read SDK versions from environment variables (like mobile-devtools examples do) instead of using hardcoded values. Changes: - Read ANDROID_COMPILE_SDK, ANDROID_TARGET_SDK, ANDROID_BUILD_TOOLS_VERSION from env - Read ANDROID_NDK_VERSION from env (if set) - Updated E2E-compat ANDROID_MAX_API from 33 to 35 to match plugin default - Default to build-tools 35.0.0 to match react-native plugin This fixes the error where Gradle tried to install API 33 but only API 35 was available in the Nix store. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a5b51d6 commit 5882d84

3 files changed

Lines changed: 19 additions & 15 deletions

File tree

examples/E2E-compat/android/build.gradle

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
buildscript {
44
ext {
5-
// Default to the build-tools pinned in devbox; allow override via ANDROID_BUILD_TOOLS_VERSION.
6-
// Keep in sync with nix/flake.nix when ANDROID_BUILD_TOOLS_VERSION is unset.
7-
buildToolsVersion = System.getenv("ANDROID_BUILD_TOOLS_VERSION") ?: "30.0.3"
5+
def compileSdkEnv = System.getenv("ANDROID_COMPILE_SDK") ?: System.getenv("ANDROID_MAX_API") ?: "33"
6+
def targetSdkEnv = System.getenv("ANDROID_TARGET_SDK") ?: System.getenv("ANDROID_MAX_API") ?: "33"
7+
buildToolsVersion = System.getenv("ANDROID_BUILD_TOOLS_VERSION") ?: "35.0.0"
88
minSdkVersion = 21
9-
compileSdkVersion = 33
10-
targetSdkVersion = 33
9+
compileSdkVersion = compileSdkEnv.toInteger()
10+
targetSdkVersion = targetSdkEnv.toInteger()
1111
kotlinVersion="1.7.20"
1212

13-
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
14-
ndkVersion = "23.1.7779620"
13+
def ndkVersionEnv = System.getenv("ANDROID_NDK_VERSION")
14+
if (ndkVersionEnv) {
15+
ndkVersion = ndkVersionEnv
16+
}
1517
}
1618
repositories {
1719
google()

examples/E2E-compat/devbox.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"IOS_APP_BUNDLE_ID": "com.analyticsreactnativeexample",
1515
"ANDROID_APP_ID": "com.analyticsreactnativeexample",
1616
"ANDROID_APP_APK": "android/app/build/outputs/apk/release/app-release.apk",
17-
"ANDROID_MAX_API": "33",
17+
"ANDROID_MAX_API": "35",
1818
"ANDROID_SDK_REQUIRED": "0"
1919
},
2020
"shell": {

examples/E2E-latest/android/build.gradle

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
buildscript {
44
ext {
5-
// Default to the build-tools pinned in devbox; allow override via ANDROID_BUILD_TOOLS_VERSION.
6-
// Keep in sync with nix/flake.nix when ANDROID_BUILD_TOOLS_VERSION is unset.
7-
buildToolsVersion = System.getenv("ANDROID_BUILD_TOOLS_VERSION") ?: "30.0.3"
5+
def compileSdkEnv = System.getenv("ANDROID_COMPILE_SDK") ?: System.getenv("ANDROID_MAX_API") ?: "35"
6+
def targetSdkEnv = System.getenv("ANDROID_TARGET_SDK") ?: System.getenv("ANDROID_MAX_API") ?: "35"
7+
buildToolsVersion = System.getenv("ANDROID_BUILD_TOOLS_VERSION") ?: "35.0.0"
88
minSdkVersion = 21
9-
compileSdkVersion = 33
10-
targetSdkVersion = 33
9+
compileSdkVersion = compileSdkEnv.toInteger()
10+
targetSdkVersion = targetSdkEnv.toInteger()
1111
kotlinVersion="1.7.20"
1212

13-
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
14-
ndkVersion = "23.1.7779620"
13+
def ndkVersionEnv = System.getenv("ANDROID_NDK_VERSION")
14+
if (ndkVersionEnv) {
15+
ndkVersion = ndkVersionEnv
16+
}
1517
}
1618
repositories {
1719
google()

0 commit comments

Comments
 (0)