При создании приложения Android React с нативным Android с React-native-inative , вы можете столкнуться с этой ошибкой. class = "Lang-Bash PrettyPrint-Override">
Код: Выделить всё
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using C:/Users/g store/Documents/Bestself/helm-focus-app/node_modules/react-native-reanimated/android/.cxx/Debug/arm64-v8a/android_gradle_build.json. See the message above for details.
- Ограничения длины пути Windows (260 символов)
- Cmake/Ninja Инструменты не справляются с длинными путями с пространствами. Reanimated uses C++ compilation that's sensitive to path issues
- Spaces in usernames (like "g store") make it worse
- macOS has Лучше Unix-подобная обработка путей
- файловая система Windows является более ограничительной
- Cmake/Ninja лучше работает на системах Unix
Это самое быстрое решение , которое работало отлично:
Код: Выделить всё
# Map your project to a virtual drive
subst R: "C:\Users\g store\Documents\Bestself\your-project"
# Navigate to the mapped drive
cd R:\android
# Build normally
.\gradlew bundleRelease
[*] снижает путь от C: \ users \ g Store \ Documents ... to r: \
[*] Привилегии администратора
[*] intact intact [*] ut -intact [*] ut -intact [*] ut -intact. />
Код: Выделить всё
# Run PowerShell as Administrator
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1
# Restart computer
Код: Выделить всё
# Copy project to short path
robocopy "C:\Users\g store\Documents\Bestself\your-project" "C:\p" /E /COPY:DAT
# Build from short path
cd C:\p\android
.\gradlew bundleRelease
Перед каким-либо решением очистите эти кеши:
Код: Выделить всё
# Navigate to project root
cd your-project
# Clean all build caches
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue android\build, android\.cxx, android\.gradle, android\app\build, node_modules\react-native-reanimated\android\.cxx
# Then try building again
< /code>
🎯 [b] Полный рабочий пример < /strong> < /h2>
Вот точная последовательность < /strong>, которая решила нашу проблему: < /p>
< /p>
Подробнее здесь: [url]https://stackoverflow.com/questions/79769067/react-native-reanimated-android-build-fails-on-windows-with-long-path-error-so[/url]
Мобильная версия