diff --git a/.github/workflows/sample-distribution.yml b/.github/workflows/sample-distribution.yml index 363f9efd8e..bf1587da0b 100644 --- a/.github/workflows/sample-distribution.yml +++ b/.github/workflows/sample-distribution.yml @@ -85,6 +85,22 @@ jobs: - name: Setup Android SDK uses: amyu/setup-android@v5 + # AGP 8.12 (RN 0.86) does not auto provision the API 37 platform and the + # auto-detected install can land under a name Gradle's `android-37` lookup + # misses. Install it explicitly into the SDK root Gradle resolves from + # (ANDROID_SDK_ROOT/ANDROID_HOME since there is no local.properties here), + # otherwise every RN module fails with: + # "Failed to find target with hash string 'android-37'". + - name: Ensure Android 37 SDK platform & build-tools + run: | + set -e + SDK_ROOT="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-$HOME/.android/sdk}}" + SDKMANAGER="$(command -v sdkmanager || echo "$SDK_ROOT/cmdline-tools/latest/bin/sdkmanager")" + echo "sdkmanager=$SDKMANAGER SDK_ROOT=$SDK_ROOT" + yes | "$SDKMANAGER" --sdk_root="$SDK_ROOT" --licenses >/dev/null 2>&1 || true + "$SDKMANAGER" --sdk_root="$SDK_ROOT" "platforms;android-37" "build-tools;37.0.0" + ls "$SDK_ROOT/platforms" + - uses: ./.github/actions/ruby-cache - name: Install && Build - SDK and Sample App uses: ./.github/actions/install-and-build-sdk diff --git a/examples/SampleApp/android/build.gradle b/examples/SampleApp/android/build.gradle index 6af6ee669e..81811f153c 100644 --- a/examples/SampleApp/android/build.gradle +++ b/examples/SampleApp/android/build.gradle @@ -3,10 +3,10 @@ import org.apache.tools.ant.taskdefs.condition.Os buildscript { ext { - buildToolsVersion = "36.0.0" + buildToolsVersion = "37.0.0" minSdkVersion = 24 - compileSdkVersion = 36 - targetSdkVersion = 36 + compileSdkVersion = 37 + targetSdkVersion = 37 ndkVersion = "27.1.12297006" kotlinVersion = "2.1.20" androidXCore = "1.0.2" diff --git a/examples/SampleApp/android/gradle.properties b/examples/SampleApp/android/gradle.properties index 5923c56006..a975406df4 100644 --- a/examples/SampleApp/android/gradle.properties +++ b/examples/SampleApp/android/gradle.properties @@ -46,3 +46,10 @@ edgeToEdgeEnabled=true # disables the check for multiple instances for gesture handler # this is needed for react-native-gesture-handler to be both a devDep of core and be a dep on the expo sample app disableMultipleInstancesCheck=true + +# We compile against Android SDK 37, but RN 0.86 pins Android Gradle Plugin +# 8.12.0, which is only validated up to compileSdk 36. The first AGP that +# supports 37 is 9.2+, and moving RN 0.86 onto AGP 9 (a breaking major) is not +# viable yet — so we use AGP's official escape hatch for "compileSdk newer than +# the tested AGP" instead of downgrading. Remove once RN ships an AGP-9 release. +android.suppressUnsupportedCompileSdk=37