Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

android studio - NDK does not contain any platforms

I want to install NDK to be able to use C/C++ native libraries. Upon trying to install the NDK, i get an error saying I do not have enough disk space in my C: Drive (because the download location is to the Temp Folder).

I've tried changing the temp path in the system variables but the ndk still downloads to C:UsersUserAppdataLocalTempPackageOperation02.

I then went to the project structure to change the Android NDK Location, but upon trying to choose ANY folder to be my NDK location, I get an error saying "NDK does not contain any platforms".

Help for either that or why the download location is to the Temp folder would be appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.7026061
sdk.dir=/Users/[username]/Library/Android/sdk

This is what the Project Structure window would normally do for you behind the scenes.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...