How to add debug symbols to build.gradle

To use the option ndk debugSymbolLevel as written in the docs you need an android gradle plugin 4.1 or later. At the time of writing the lastest 4.1 version is 4.1.2

You will need also to install ndk and cmake for android studio.

In your android build.gradle you need the to set android gradle plugin version 4.1.2:

buildscript {
    ...
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
        ...
    }

Then in the android/app build.gradle add:

...
android {
    ...
    // you see the ndk version in the android studio sdk-manager
    // have a look also here: https://stackoverflow.com/a/65747847/9481613
    ndkVersion "21.3.6528147" 
    ...
    buildTypes {
        release {
            ...
            ndk {
                debugSymbolLevel 'SYMBOL_TABLE'
            }
        }   
    }
}

when you then run: flutter build appbundle it should finish after a while with an appbundle that is twice the size.

Leave a Comment