No version of NDK matched the requested version in flutter >> Solved.

I was attempting to link Firebase with my Flutter app using the SHA1 key.
Several projects started failing independently after switching to Android Gradle plugin 3.6.0 (published on February 24, 2020), with the following error:

Version 20.0.5594570 of the NDK was not available. Locally accessible versions are 21.0.6113669.
It’s very easy to “fix” this locally by installing the previous version of the expected ndk:

ndk;20.0.5594570 in the sdkmanager
I want to know, though, where and how this previous version is specified. And how can I upgrade it to the most recent 21.0.6113669 version?

After some research, I discovered the answer.

The machine you are using right now, I’m assuming, has NDK installed, and it was able to create your project before, but it started failing with the

Option 1:

In the Project Structure Dialogue, you can just choose the NDK that is already installed locally.

By selecting File > Project Structure… or by hitting the Windows hotkeys CTRL + ALT + SHIFT + S, you can access the Project Structure Dialogue.

Option 2:

Option 1 will typically work because it will edit your local.properties file for you. But in accordance with this official instructions, you can configure it from your module gradle script if you wish to use a consistent NDK version across all computers you use to build the project. Simply include the ndkVersion in the android section of your module gradle script.

android {
    ndkVersion "major.minor.build"
}

replacing the string between the double quotes with the NDK version you want to use

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x