Ndk Does Not Contain Any Platforms
Solution 1:
For people seeing this in 2021:
The Android NDK's platform
directory has been obsolete since r19. The NDK team removed it altogether in r21 in January 2021. Although it is obsolete, it can still cause the above error in the Project Structure window. The stable version of the Android Studio IDE (at least on Mac) is still looking for the platform
directory when you select an r21 or higher version and try to Apply it. The IDE gives the error "NDK does not contain any platforms."
Until Android Studio is updated to stop looking for platform
, you can edit the local.properties
file yourself, like so:
ndk.dir=/Users/[username]/Library/Android/sdk/ndk/22.0.7026061sdk.dir=/Users/[username]/Library/Android/sdk
This is what the Project Structure window would normally do for you behind the scenes.
Solution 2:
directory of ndk is now within the sdk folder which is named as ndk and ndk-bundel but the assigning of ndk is now change we need to add ndk version in Android Gradle Plugin (AGP) like this
android {
ndkVersion "version" // e.g., ndkVersion '21.3.6528147'
}
you need also install CMake from SDK tools from sdk manager and need to set is also from the Gradle like below
android {
...
externalNativeBuild {
cmake {
...
version "cmake-version"
}
}
}
Solution 3:
I got the same problem when I set the NDK dir with something like "SOME_DIRECTORY/ndk".
I resolved this problem by setting it as "SOME_DIRECTORY/ndk/21.0.6113669".
Solution 4:
May be you need an old version of ndk, like android-ndk-r20b. Because I found that there is no platforms directory in unzipped android-ndk-r22 folder. I resolved this issue by configuring Android studio to android-ndk-r20b. Here is the download link https://developer.android.com/ndk/downloads/older_releases
Solution 5:
As suggested on https://developer.android.com/studio/projects/install-ndk if you are using gradle version above 3.5.0 and uninstall the legacy NDK, you should remove the ndk.dir value, which is now deprecated, from your projects' local.properties files.
Post a Comment for "Ndk Does Not Contain Any Platforms"