How to fix NDK is not installed error in React Native or Flutter:
NDK or Native Development Kit is a toolset in Android that allows you to write code in C and C++. You need to download and install this kit on your system if your app is using NDK.
The stacktrace I am sharing in this post is from a React Native app, but you can follow the same steps for Native, React Native or Flutter.
Below is the complete stack trace of this error:
> Task :rn-fetch-blob:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :app:extractReleaseNativeSymbolTables FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:extractReleaseNativeSymbolTables'.
> NDK is not installed
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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
BUILD FAILED in 58s
439 actionable tasks: 380 executed, 59 up-to-date
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This error comes while I was trying to create a release apk in a React Native app. It might work in debug mode and fail in release mode.
You will see an error something like below on the console:
Solution: Check if NDK is installed or not:
You need to check if NDK is installed or not in your system. You can check it directly from Android Studio.
This is available under SDK Manager in Android Studio. Open your Android Studio, go to tools and click on SDK Manager.
It will show you a window with three tabs: SDK Platforms, SDK Tools and SDK Update sites.
Click on SDK Tools. Here, you will see if NDK is installed or not in your system. If it looks as like the above image, it means that NDK is not currently installed on your system. You need to click on the tick-box of NDK(Side by side) and click on Apply to start the installation.
It will show you a popup as like below:
Click on OK and it will start the installation.
Update the NDK version in build.gradle:
Once the NDK is installed, you need to update the installed NDK version number in your app level build.gradle file. Inside app/build.gradle, you will find it under android:
Update the version code and run it again. It should fix the issue.