React Native Android构建因NDK报错失败,求解决方案
Hey there, let's tackle this frustrating build failure together! The error you're seeing about missing mipsel-linux-android-strip is directly tied to NDK r17 and later versions removing support for MIPS architectures—even though you've already removed armeabi from your config, there are still a few loose ends to tie up.
Why This Happens
NDK r17 completely dropped MIPS toolchains, but your build process is still trying to look for MIPS-related tools or files somewhere. This could be from leftover config, cached build artifacts, or third-party dependencies that still include MIPS binaries.
Actionable Fixes to Try
1. Pin Your NDK Version to a Pre-r17 Release
Instead of relying on the default NDK in AppCenter, explicitly specify an NDK version that still includes MIPS support (like r16b). Add this line inside your android block in build.gradle:
android { // ... other existing configs ndkVersion "16.1.4479499" // This is the version code for NDK r16b }
You can also set this directly in AppCenter's build settings: go to your app's build configuration, find the Android section, and specify the NDK version under "Build options".
2. Exclude MIPS Architectures from Packaging
Even with abiFilters set, some third-party libraries might still bundle MIPS .so files. Add these packaging rules to your android block to explicitly exclude them:
android { // ... other existing configs packagingOptions { exclude "lib/mips/**" exclude "lib/mips64/**" } }
This tells Gradle to ignore any MIPS-related native files, so it won't try to run the missing strip tool on them.
3. Clean AppCenter's Build Cache
AppCenter might be holding onto cached build artifacts from previous runs that still reference MIPS. Add a clean step to your build script to wipe these out:
In your AppCenter build configuration, under "Pre-build script", add:
./gradlew clean
This ensures you're starting with a fresh build every time.
4. Verify Third-Party Dependencies
Check if any of your installed npm packages or Android libraries are still including MIPS binaries. You can inspect the libs folders of your dependencies to see if there are mips or mips64 directories. If you find any, consider updating those dependencies to versions that have dropped MIPS support, or reach out to the package maintainers for fixes.
Final Checks
After applying these changes, re-run your AppCenter build. If it still fails, double-check that all instances of abiFilters only include architectures supported by your NDK version (x86, x86_64, armeabi-v7a, arm64-v8a for r17+).
内容的提问来源于stack exchange,提问作者Sharath Chandra

