Qamar
Qamar

Reputation: 5135

Gradle build error with NDK version - ndk.dir version which disagrees with android.ndkVersion

After upgrading the Gradle plugin and Android Studio 4.2.1. I face this error while building the C++ library.

Caused by: com.android.builder.errors.EvalIssueException: NDK from ndk.dir at D:\Sdk\ndk\18.0.5002713 had version [18.0.x] which disagrees with android.ndkVersion [22.1.x]

Upvotes: 4

Views: 5285

Answers (2)

gkpatel
gkpatel

Reputation: 1

Open the location "C:\Users\admin\AppData\Local\Android\Sdk\ndk". Here, you will find multiple files with names starting with "18.0.5002713". Open each file:

  • keep the file which has source.properties
  • delete the other files. They will have names starting with "18.0.5002713" and ending with "-1","-2"..etc.

Upvotes: 0

Qamar
Qamar

Reputation: 5135

Very simple solution. Remove ndk.dir from local.properties,

and declare ndkVersion inside build.gradle in app/library level

android {
    compileSdkVersion 30
    ndkVersion "18.0.5002713"
    ...
}

Thanks

Upvotes: 10

Related Questions