问题

        error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':app'. > [CXX1101] NDK at C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\27.1.12297006 did not have a source.properties file * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 4s.
解决办法:

1.验证并修复 NDK 安装

  • 检查 NDK 目录

        打开C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\27.1.12297006,确认是否存在 source.properties 文件。若缺失,需重新安装或更新 NDK。

  • 通过 Android Studio 安装 NDK
    打开 Android Studio → SDK Manager → SDK Tools → 勾选 NDK (Side by side),选择稳定版本(如 25.x 以上),完成安装

2. 配置 NDK 版本(关键)

在项目的 android/app/build.gradle 中指定兼容的 NDK 版本:

android {
    ndkVersion "25.2.9519653"  # 根据实际安装版本修改
}

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐