Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is defined flutter.ndkVersion in build.gradle?

Tags:

gradle

flutter

I am able to build the apk but with a warning of a wrong ndk version. I have gradle-7.5-all. In my android/app/build.gradle i have the following code:

android {
    namespace "com.example.pull_to_refresh_rive_flutter"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

I found the file local.properties with the following:

flutter.sdk=C:\\app\\flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1

Notice that nor compileSdkVersion nor ndkVersion are specified.

I did a search with 'ndkVersion' on the whole directory android and found nothing (only ndkVersion flutter.ndkVersion in build.gradle).

Where are defined flutter.compileSdkVersion and flutter.ndkVersion ?

Thank you guys.

like image 964
Laurent Avatar asked Sep 05 '25 03:09

Laurent


1 Answers

Thanks to 3nws, I found where it is defined. It's no more in the project but in the flutter distribution. <flutter_dir>\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy

We have:

class FlutterExtension {
    /** Sets the compileSdkVersion used by default in Flutter app projects. */
    static int compileSdkVersion = 33

    /** Sets the minSdkVersion used by default in Flutter app projects. */
    static int minSdkVersion = 19

    /** Sets the targetSdkVersion used by default in Flutter app projects. */
    static int targetSdkVersion = 33

    /**
     * Sets the ndkVersion used by default in Flutter app projects.
     * Chosen as default version of the AGP version below as found in
     * https://developer.android.com/studio/projects/install-ndk#default-ndk-per-agp
     */
    static String ndkVersion = "23.1.7779620"

Hope this help.

like image 81
Laurent Avatar answered Sep 09 '25 02:09

Laurent