diff --git a/README.md b/README.md index 02265b1b..7d6d96c9 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,10 @@ export default { +## Building on Windows (CMake long-path failures) + +On Windows, the Android build can fail with `ninja: error: mkdir(CMakeFiles/rive.dir/...): No such file or directory` due to the Windows `MAX_PATH` (260 character) limit. This is a [known issue across React Native libraries that use CMake](https://docs.swmansion.com/react-native-reanimated/docs/guides/building-on-windows/). Set `CMAKE_VERSION=3.31.6` before building — see the Reanimated docs for full setup instructions. + ## Error Handling All Rive operations can be wrapped in try/catch blocks for error handling, for example, loading a file: diff --git a/android/build.gradle b/android/build.gradle index 5cf1cd50..61402d68 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -69,6 +69,13 @@ android { externalNativeBuild { cmake { path "CMakeLists.txt" + // On Windows the NDK default CMake (3.22.1) fails when object-file + // paths exceed MAX_PATH (260 chars). Set CMAKE_VERSION=3.31.6 to fix. + // See: https://docs.swmansion.com/react-native-reanimated/docs/guides/building-on-windows/ + def cmakeVersionOverride = System.getenv("CMAKE_VERSION") + if (cmakeVersionOverride) { + version cmakeVersionOverride + } } }