Flutter: build ndk version mismatch after upgrade

Viewed 14675

My flutter app could build fine before, but after updating Android Studio and Flutter today I get the following error when trying to build: "No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.0.6113669". How can this error be solved?

4 Answers

If this issue occurred after updating android studio to 3.6 or updating the gradle plugin or gradle wrapper, then you can simply select your locally installed NDK in the Project Structure Dialog

You can open the Project Structure Dialog by clicking File > Project Structure... or by pressing the hotkeys CTRL + ALT + SHIFT + S

Once the Project Structure Dialog is open, go to SDK Location and select your locally installed version of NDK under Android NDK Location. Typically this is installed somewhere in your user folder then \AppData\Local\Android\Sdk\ndk\%ndk version% at least for Windows.

Project Structure dialog screenshot

It's usually recommended to install the latest version fo NDK available and use that for your projects.

For Flutter apps, First you have to open the android path as a project. You can do it by opening some file for editing under the "android" folder end then click "Open for Editing in Android Studio" on top.

Then you can do as @Subaru suggests:

You can open the Project Structure Dialog by clicking File > Project Structure... or by pressing the hotkeys CTRL + ALT + SHIFT + S

Once the Project Structure Dialog is open, go to SDK Location and select your locally installed version of NDK under Android NDK Location. Typically this is installed somewhere in your user folder then \AppData\Local\Android\Sdk\ndk\%ndk version% at least for Windows.

You can update in your local.properties the property which point to the ndk location : ndk.dir=/Users/Shared/develop/android-sdk/ndk-bundle

Related