From 25e3a56dba899c1f91408847f9c83f288ed21bcd Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Fri, 3 May 2024 13:52:26 +0530 Subject: [PATCH] chore: pin cmake version (#19865) On brand new ubuntu setup `make run-android` fails with : ``` Task :app:mergeExtDexDebug FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'. [CXX1300] CMake '3.22.1' was not found in SDK, PATH, or by cmake.dir property. BUILD FAILED in 2m 30s 673 actionable tasks: 673 executed error: cannot unlink '/tmp/tmp-status-mobile-a094d218d/ nix-build-status-mobile-build-debug-android.drv-0/tmp.moQHI1tJWE/caches/8.4': Directory not empty removed '/tmp/tmp-status-mobile-a094d218d/tmp.RpThXxcRZR' make: *** [Makefile:278: run-android] Error 1 ``` we do have `cmake` present in Android Shell and yet the build process is not able to find it. This commit makes sure that we explicitly provide that reference. --- android/app/build.gradle | 8 ++++++++ nix/pkgs/android-sdk/compose.nix | 1 + 2 files changed, 9 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index b7b7d05bb4..cc8b6f92d6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -145,6 +145,14 @@ android { jvmTarget = JavaVersion.VERSION_17 } + // https://developer.android.com/studio/projects/install-ndk#vanilla_cmake + externalNativeBuild { + cmake { + // This version must match cmakeVersions inside nix/pkgs/android-sdk/compose.nix + version "3.22.1" + } + } + compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 diff --git a/nix/pkgs/android-sdk/compose.nix b/nix/pkgs/android-sdk/compose.nix index c73aaee430..8233a3f079 100644 --- a/nix/pkgs/android-sdk/compose.nix +++ b/nix/pkgs/android-sdk/compose.nix @@ -16,6 +16,7 @@ androidenv.composeAndroidPackages { platformToolsVersion = "33.0.3"; buildToolsVersions = [ "34.0.0" ]; platformVersions = [ "34" ]; + # This version must match cmake version inside android/app/build.gradle cmakeVersions = [ "3.22.1" ]; ndkVersion = "25.2.9519653"; includeNDK = true;