NDK is not installed

2,894

Solution 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

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.

Share:
2,894
Nailuj29
Author by

Nailuj29

I mostly do Android and web development

Updated on December 28, 2022

Comments

  • Nailuj29
    Nailuj29 over 1 year

    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.

  • Nailuj29
    Nailuj29 almost 3 years
    im using flutter, but my solution was very similar, so I'll accept this
  • JCutting8
    JCutting8 almost 3 years
    Although this solves the error, I don't think its a very good solution to the problem. Having debug symbols is important. How about providing informatino about how to install the missing NDK?
  • Abhinav Kaushal Keshari
    Abhinav Kaushal Keshari over 2 years
    This is not a solution
  • Kumar Aditya Mohta
    Kumar Aditya Mohta over 2 years
    Hey, please check the other answer by me, had the same issue, finally solved it in the right way.
  • Sahil
    Sahil over 2 years
    @Nailuj29 this seems to be the right answer. Please accept this.
  • dan-gph
    dan-gph over 2 years
    Specifying the ndkVersion as above didn't work for me. This worked: stackoverflow.com/a/59275504/60620
  • dan-gph
    dan-gph over 2 years
    On Ubuntu my ndk was located here: ~/Android/Sdk/ndk . You can also check the "Show Package Details" checkbox in the Tools > SDK Manager to see the installed version of ndk.
  • Randolfo
    Randolfo over 2 years
    It worked for me