When building a flutter app, I get an error stating
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:extractReleaseNativeDebugMetadata'.
> NDK is not installed
* 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 822ms
However, the android NDK is installed.
I had the same issue. I wanted to extract the debug symbols for better debugging in the production environment.
NDK
and CMAKE
SDK tool from android studios (You can skip it, if already installed)Open any project in Android studio. (Doesn't matter which project. We just want to access SDK manager)
With a project open, click Tools > SDK Manager
.
Click the SDK Tools tab.
Select the NDK (Side by side) and CMake checkboxes.
Image of SDK Manager
Click OK.
A dialog box tells you how much space the NDK package consumes on disk.
Click OK.
When the installation is complete, click Finish.
To check, find the NDK folder inside the Android SDK folder. For mac users, it is located at - ~/Library/Android/sdk/ndk/
You will find a folder with the NDK version name inside this directory.
For example - in my case, the installed NDK version was 23.0.7599858
. So, I was able to find this directory at this location ~/Library/Android/sdk/ndk/23.0.7599858/
Note: For Ubuntu or windows users sdk/ndk
directory's location will be different.
android/build.gradle
file.buildscript {
ext {
...
ndkVersion = "23.0.7599858" # the installed version of ndk.
}
...
}
EDIT:
Make sure you have ndkVersion
initialized in the app/build.gradle
like this:
android {
...
ndkVersion rootProject.ext.ndkVersion
...
}
Or you can also directly write the version here like this:
android {
...
ndkVersion "23.0.7599858"
...
}
You don't have to add the ndkVersion in android/build.gradle
if you do this.
Using android studio open a. Go to settings, System settings, android sdk,on the tabs select SDK Tools confirm if NDK (side by side) and CMake Tool are installed b. If not installed check them and press apply to download and install them.
After successfull confirmation. Open your project android folder find local.properties file, android/local.properties. You will find Something like this
Add your NDK path as follows
To find yoour NDK path
Happy Coding ! ! !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With