Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Flutter Android build fails because the app has too many methods

ErrorToo many field references: 131000; max is 65536.

Short answer

One DEX file can reference at most 65,536 methods. Large plugins can pass that. If minSdk is 21 or higher, multidex is built in and the error should not appear. For a lower minSdk, either raise minSdk or enable multidex: Flutter offers to do it when you run a debug build, or you set multiDexEnabled in Gradle.

  • Applies to Flutter 3.x stable, Android Gradle plugin 8.x, Android 5.0+ devices
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open the app module's Gradle file and read the minSdk line. It tells you which cause applies: the value is a number, or it comes from flutter.minSdkVersion.

    grep -n -i "minSdk\|multiDex" android/app/build.gradle*
  2. 2Match what you see, then jump to its fix

    1. 1Too many field references ... max is 65536, with a minSdk of 20 or lessminSdk is 20 or lower, so multidex is not automaticFix
    2. 2minSdk has to stay at 20 or lower and the 64K error remainsYou must keep an old minSdk and have to enable multidex yourselfFix

What does the error look like?

  • Too many field references: 131000; max is 65536.
  • You may try using --multi-dex option.
  • method ID not in [0, 0xffff]: 65536

Cause 1 of 2

minSdk is 20 or lower, so multidex is not automatic

1Check

Android 5.0 (API 21) and newer load several DEX files natively, so multidex is on by default there. Below that, one DEX file per APK is the rule.

grep -n -i "minSdk" android/app/build.gradle*

2Fix

If you can drop Android 4.4 and older, raise minSdk to 21. That removes the limit without any library. Flutter's template reads the value from flutter.minSdkVersion, and you can replace it with a number.

// android/app/build.gradle.kts
defaultConfig {
    minSdk = 21
}

3Verify

A clean build finishes without the field references error.

flutter clean
flutter build apk --debug

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 2

You must keep an old minSdk and have to enable multidex yourself

1Check

Flutter's tool can opt a project in. When you run a debug build on an Android device and it asks about multidex, answering yes lets Flutter add androidx.multidex and a generated FlutterMultiDexApplication.

flutter run --debug

2Fix

Answer y to the multidex prompt. To do it in Gradle by hand, set multiDexEnabled and add the multidex library, as the Android docs show.

// android/app/build.gradle.kts
android {
    defaultConfig {
        multiDexEnabled = true
    }
}
dependencies {
    implementation("androidx.multidex:multidex:2.0.1")
}

3Verify

The app builds and starts on the old device or emulator.

flutter build apk --debug

Confirmed by docs.flutter.dev

Did this fix it?

How do I stop it coming back?

  • Set minSdk to 21 unless you really need older phones.
  • Review large plugins before adding them; each one adds methods.
  • Keep R8 code shrinking on for release builds.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Google Play says the app does not support 16 KB memory pages

check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a

Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.