How can I specify custom NDK path in Android studio 4.1.3, gradle 6.8.3?

Viewed 558

I am upgrading Android studio and Android gradle plugin to 4.1.3 and gradle to 6.8.3. I am using some protection for my code, which has its own special NDK 16b, which works with it without problems. But that means, that I need to put this "security NDK 16b" to specific location and then tell the path to Android studio.

I have ndk.dir=myPath\android-ndk-r16b in my local.properties file. With the upgrade I can still build successfully, but there is new warning:

WARNING: NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please use android.ndkVersion or android.ndkPath in build.gradle to specify the NDK to use. https://developer.android.com/r/studio-ui/ndk-dir

So I tried to use android.ndkVersion or android.ndkPath to point to ndk like this according to android docs (in my app build.gradle):

android {
    ndkPath 'myPath/android-ndk-r16b'  // Point to your own NDK
    ndkVersion '16.1.4479499'
 /// other stuff
}

but then it shows this error:

NDK at "pathToSDK\sdk\ndk-bundle" did not have a source.properties file

It searches for ndk in default Android studio path, so it seems, it does not use ndkPath property at all...

Should I use the ndkPath property in a different way? Does it work for someone?

0 Answers
Related