Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NDK location not configurable

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

like image 936
Andriy Avatar asked Dec 18 '20 23:12

Andriy


1 Answers

  • 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

like image 191
Hassan Uddin Avatar answered Sep 20 '22 18:09

Hassan Uddin