android
build_error
ai_generated
true
CMake Error at /path/to/android-ndk-r26c/build/cmake/android.toolchain.cmake:XX (message): Invalid Android STL: c++_shared. The STL 'c++_shared' is not supported for target architecture 'mips'. Only 'none' and 'system' are supported.
ID: android/ndk-cmake-toolchain-architecture-mismatch
88%Fix Rate
84%Confidence
1Evidence
2024-04-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| NDK r26c | active | — | — | — |
| NDK r25b | active | — | — | — |
| CMake 3.22.1 | active | — | — | — |
Root Cause
NDK's CMake toolchain is configured to target a deprecated or unsupported architecture (e.g., MIPS) with an STL type that is not available for that ABI, often due to incorrect `ANDROID_ABI` or `APP_ABI` setting in build scripts.
generic中文
NDK 的 CMake 工具链配置为针对已弃用或不支持的架构(例如 MIPS)使用该 ABI 不可用的 STL 类型,通常是由于构建脚本中的 `ANDROID_ABI` 或 `APP_ABI` 设置不正确。
Official Documentation
https://developer.android.com/ndk/guides/cmakeWorkarounds
-
90% success Update your `build.gradle` (Module: app) to set `abiFilters` to supported architectures only, removing MIPS: `android { defaultConfig { ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } }`
Update your `build.gradle` (Module: app) to set `abiFilters` to supported architectures only, removing MIPS: `android { defaultConfig { ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } }` -
85% success If using a custom CMake toolchain file, set `set(ANDROID_ABI "arm64-v8a")` before including the NDK toolchain, and ensure `APP_ABI` in `Application.mk` (if using ndk-build) does not include `mips`.
If using a custom CMake toolchain file, set `set(ANDROID_ABI "arm64-v8a")` before including the NDK toolchain, and ensure `APP_ABI` in `Application.mk` (if using ndk-build) does not include `mips`.
中文步骤
Update your `build.gradle` (Module: app) to set `abiFilters` to supported architectures only, removing MIPS: `android { defaultConfig { ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } }`If using a custom CMake toolchain file, set `set(ANDROID_ABI "arm64-v8a")` before including the NDK toolchain, and ensure `APP_ABI` in `Application.mk` (if using ndk-build) does not include `mips`.
Dead Ends
Common approaches that don't work:
-
90% fail
The same error occurs because the architecture (MIPS) does not support any c++ STL variant except 'none' or 'system'. The issue is the ABI, not the STL variant.
-
95% fail
The error is a configuration issue, not a cache issue. Rebuilding will reproduce the same error if the ABI setting is unchanged.