22

In project settings (File -> Project Structure) 'Android NDK location' field is greyed out:

enter image description here

Clicking on 'Download Android NDK' briefly displays some dialog. There are several versions of NDK installed:

enter image description here

What is wrong with my setup?

Host: Ubuntu 18.04 LTS

Android Studio 4.1.1 Build #AI-201.8743.12.41.6953283, built on November 5, 2020 Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.15.0-128-generic GC: ParNew, ConcurrentMarkSweep Memory: 2014M Cores: 4 Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true, debugger.watches.in.variables=false Non-Bundled Plugins: com.intellij.ideolog, org.jetbrains.kotlin Current Desktop: LXDE

Submitted bug report

3 Answers 3

29
  • Leave SDK Location ;) we can still select from Files> Project Structure> Modules> NDK Version

img1

  • Or, Simply Add

ndkVersion '22.0.7026061'

in build.gradle(app) like this

externalNativeBuild { ndkBuild { path file('src/main/jni/Android.mk') } } ndkVersion '22.0.7026061' // your desire version dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) } 

img2

  • Extra Tips:--- you can set path variable here enter image description here

  • Still App not Building for NDK ??

    1. Close Android Studio.

    2. Delete .temp folder located C:\Users\%USERNAME%\AppData\Local\Android\Sdk (if exist)

    3. Delete Options Folder located in C:\Users\%USERNAME%\AppData\Roaming\Google\AndroidStudio4.1\

    4. Delete NDK or ndk-bundle folder located in your SDK directory... in my case D:\Android\SDK\ndk

    5. Now clean temps from SDK Manager > Optimize disk Space [don't worry it will not delete your essential files] enter image description here

    6. Now, install your desire NDK version from SDK Manager enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, however this workaround does not answer the question
are you sure you have the exact version of what the project seeking? if not click on the download text may solve the issue.
8

I had this problem and by setting NDK value in local.properties file of my project, that problem gone

ndk.dir=D\:\\mySdkFolder\\sdk\\myNdkFolder sdk.dir=D\:\\mySdkFolder\\sdk 

2 Comments

NDK location field is still greyed out
@Andriy yeah but the path added in local.properties shows in the ndk location field. so for me I use local.properties to edit the ndk location.
1

With a project open, click Tools > SDK Manager.

Click the SDK Tools tab.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.