You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native安卓构建报错:Task :app:configureCMakeDebug[arm64-v8a]失败

Fix CMake Invalid Escape Character '\C' Error in Expo Android Build
  • Check and Fix Environment Variables
    Ensure all path-related environment variables (like ANDROID_HOME, JAVA_HOME) use forward slashes (/) instead of backslashes (\). For example, change C:\Android\Sdk to C:/Android/Sdk. Edit these variables via System Properties > Advanced > Environment Variables.

  • Update local.properties File
    Navigate to your project's android directory, open the local.properties file. Modify path entries to use forward slashes. Example:

    sdk.dir=C:/Android/Sdk
    ndk.dir=C:/Android/Sdk/ndk/25.2.9519653
    

    If the file doesn't exist, create it and add these lines with your actual SDK/NDK paths.

  • Inspect CMakeLists.txt for Path Issues
    Check any CMakeLists.txt files in your project (including native dependencies) for paths using unescaped backslashes. Replace \ with / or escape them as \\. For example, change set(SOURCE_DIR C:\src) to set(SOURCE_DIR C:/src).

  • Clear Node Modules and Reinstall Dependencies
    Delete the node_modules folder and package-lock.json (or yarn.lock), then run npm install (or yarn install) to reinstall dependencies. This resolves issues from broken or misconfigured native modules.

  • Switch to PowerShell or WSL
    If using Command Prompt, try running the build command in PowerShell instead. Alternatively, use WSL (Windows Subsystem for Linux) for the build—Unix-style path formatting is more compatible with CMake.

  • Verify NDK Installation and Path
    Confirm you have the correct NDK version installed (check your project's build.gradle for requirements). Set the NDK path in local.properties or via the ANDROID_NDK_HOME environment variable, using forward slashes.

内容的提问来源于stack exchange,提问作者mukunda

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 02:15:54