'NDK is not installed

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.



Solution 1:[1]

I got that error on React Native 0.64 app on AppCenter build for Android. The solution is to go to android/app/build.gradle file and comment ndk { debugSymbolLevel 'FULL' } line if you have so (defaultConfig { ndk { debugSymbolLevel } })

The solution was found by my colleague Jose, so all credits to him)

Solution 2:[2]

I had the same issue. I wanted to extract the debug symbols for better debugging in the production environment.

Solution

Step 1: Installing 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)

  1. With a project open, click Tools > SDK Manager.

  2. Click the SDK Tools tab.

  3. Select the NDK (Side by side) and CMake checkboxes.

Image of SDK Manager

enter image description here

  1. Click OK.

  2. A dialog box tells you how much space the NDK package consumes on disk.

  3. Click OK.

  4. When the installation is complete, click Finish.

Step 2

1. Check which version of NDK is installed in your system.

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.

2. Ensure you have the same NDK version mentioned in the 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.

Solution 3:[3]

  1. 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.SDK TOOLS confir, NDK and CMake

  2. After successfull confirmation. Open your project android folder find local.properties file, android/local.properties. You will find Something like thislocal.properties file

Add your NDK path as followsadding ndk path

To find yoour NDK path

  1. Go to home files if linux, android folder, sdk folder, inside find ndk folder, ie /Android/Sdk/ndk/24.0.8215888

Happy Coding ! ! !

Solution 4:[4]

I have only installed ndk from the android studio and My problem just got solved, After including ...

local.properties

ndk.dir=<ANDROID_SDK>\\ndk\\XX.X.XXXXXXX

android/app/build.gradle

android {
    // ...

    ndkVersion "XX.X.XXXXXXX"
    // ...

    buildTypes{
        release{
            signingConfig signingConfigs.release
            ndk {
            debugSymbolLevel 'SYMBOL_TABLE'
             }
        }
    }
}

This could help someone and save his/her time.

Solution 5:[5]

If you are using Flutter Please use this approach(according to your ndk version from checkin android studio), it solved my problem and I used it for debug symbols native crashes

android { ... ndkVersion "23.0.7599858" ... }

Solution 6:[6]

After I added

ndk {
    debugSymbolLevel 'FULL'
}

in app build.gradle file I got this error about NDK not installed.

I resolved the same problem by making this change in main build.gradle file

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.3'
...
    }

This Gradle upgrade forced me to upgrade the url in gradle/wrapper/gradle-wrapper.properties file

distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip

I have Android Studio Bumblebee 2021.1.1 Patch 3

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3 vinchuli
Solution 4 Spsnamta
Solution 5 utkudenis
Solution 6 Boris