xxxxxxxxxx
After specifying ndk version in build.gradle file it is working
android {
ndkVersion '21.3.6528147'
}
And inside local.properties remove the following since it's deprecatedand also conflicts with path:
ndk.dir=~/Library/Android/sdk/ndk-bundle