3

When I try setting ndk version on android studio, via project structure -> sdk location, the search box is grayed out. So I went to the local.properties file, and set ndk.dir there. But the issue is that when I do this, android studio can't sync gradle, and it constantly throws me this "SILLY ERROR"

Gradle sync failed: exception during working with external system:

I tried setting system environment variable for the ndk directory, but it still didn't function !!!!!!!

This IDE is frustrating. where should I set my NDK version then ? I stuck and every solution I try online doesn't work.

John Code
  • 655
  • 7
  • 24

2 Answers2

2

The recent version of Android Gradle Plugin expect you to install NDK (side by side) via the SDK Manager, and choose the version for your module in build.gradle:

android {
    …
    android.ndkVersion '19.2.5345600'
}
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • Thanks, But when I do that, I get this error "Could not find method ndkVersion() for arguments [21.3.6528147] on project " – John Code Dec 27 '20 at 10:57
  • See [https://github.com/android/ndk/issues/1313#issuecomment-656826716] and upgrade your Android Gradle Plugin. – Alex Cohn Dec 27 '20 at 16:18
-2

The reason that your SDK location is grayed out might be because you don't have one installed.

I found this question asked earlier that can help you solve this problem:

Android Studio SDK Managed Disabled