Flutter Android: One or more plugins require a higher Android NDK version
Asked Answered
C

7

6

One or more plugins require a higher Android NDK version.

Fix this issue by adding the following to /Users/qqq/data/github/qqq/qqq/android/app/build.gradle: android { ndkVersion 21.3.6528147 ... }

But if I add ndkVersion and my file looks like this:


android {
    compileSdk 31

    ndkVersion 21.3.6528147

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
...

I receive different error:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/qqq/data/qqq/qqq/qqq/android/app/build.gradle' line: 61

* What went wrong:
Could not compile build file '/Users/qqq/data/github/qqq/qqq/android/app/build.gradle'.
> startup failed:
  build file '/Users/qqq/data/github/qqq/qqq/android/app/build.gradle': 61: Unexpected input: '{' @ line 61, column 9.
     android {
             ^

  1 error
Cress answered 19/7, 2022 at 7:32 Comment(0)
S
21

According to official doc(https://developer.android.com/ndk/downloads) latest ndk version is 25.0.8775105 just update to latest and error should be gone.

Solution for 2022:

android {
    ndkVersion "25.0.8775105" <-- add this line
}

Solution for March 2023:

android {
    ndkVersion "25.2.9519653"
}

Solution for April 2024

android {
    ndkVersion "26.3.11579264"
}
Shelves answered 19/7, 2022 at 7:54 Comment(3)
yeah, You are right! I forgot about "" ;)Cress
wish the error message included the quotes instead of giving the confidence that it's a simple fix to add without quotes.Darell
has any problems bump this value for users? in my app has a lot of users with bad devices, using android 6, 9 etc.Trehala
T
1

For those using a flutter module in a native Android apk, you will receive this error:

One or more plugins require a higher Android NDK version.
Fix this issue by adding the following to ...\flutter_module\.android\Flutter\build.gradle:

As you can't edit this generated file, you'll have to change this file:

<flutter_dir>\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy

you can add this to local.properties:

static String ndkVersion = "25.1.8937393"
Terefah answered 29/3, 2024 at 9:9 Comment(0)
V
0

I was facing the same issue and I managed to solve it, by setting default values ...MyProject\android\app\build.gradle

defaultConfig {
   
    targetSdkVersion 33
    minSdkVersion 30
   ...
}
Vazquez answered 1/12, 2022 at 10:14 Comment(0)
B
0
android {
    ndkVersion "25.2.9519653"
}

Add the above lines

Brusa answered 14/3, 2023 at 13:27 Comment(0)
F
0

In your android/app/build.gradle file update your NDK version:

android {
  ndkVersion "25.1.8937393"
  ...
}
Fallacious answered 24/8, 2023 at 1:41 Comment(0)
K
0

In android/app/build.gradle add Latest ndkversion Current ndkversion '25.1.8937393' android { namespace "" compileSdkVersion flutter.compileSdkVersion ndkVersion "25.1.8937393"

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
Kugler answered 25/10, 2023 at 11:1 Comment(0)
C
0

Latest LTS Version (r26d)

android {
    ndkVersion "26.3.11579264"
}

Check here for any update :

https://developer.android.com/ndk/downloads

Caviness answered 22/4, 2024 at 11:21 Comment(1)
This answer doesn't make sense, in a couple of days we can have a new version and link to android docs can change too, so it looks like a comment "update to latest" and try again.Eastnortheast

© 2022 - 2025 — McMap. All rights reserved.