DEV Community

Cover image for [Solved] Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536)
FlutterCorner
FlutterCorner

Posted on

[Solved] Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536)

Hello Guys, How are you all ? Hope you all are fine. While I am attempting to use firestore with a Flutter app in latest version of Android Studio, I am facing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) this error in my stack track.

So here is this article to gat all possible solution to solve Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536). Lets start this article without wasting your time.

What is Error ?

While I am attempting to use firestore with a Flutter app in latest version of Android Studio, I get the following error when I attempt to run my new app after completing all the steps up to (and including) updating pubspec.yaml

Here is my Stack Track

D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\2.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\3.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\4.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\5.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\6.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\7.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\8.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\9.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\10.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\11.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\12.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\13.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\14.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\15.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\16.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\17.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\18.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\19.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\20.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\21.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\22.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\23.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\24.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\25.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\26.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\27.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\28.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\29.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\30.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\31.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\32.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\33.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\34.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\35.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\36.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\37.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\38.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\39.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\40.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\41.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\42.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\43.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\44.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\45.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\46.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\47.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\48.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\49.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\50.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\51.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\52.jar, C:\Users\DonBo\AndroidStudioProjects\don_flutter_projects\bakery\bakery\build\app\intermediates\transforms\dexBuilder\debug\53.jar
  The number of method references in a .dex file cannot exceed 64K.
  Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 21s
Finished with error: Gradle task assembleDebug failed with exit code 1
Enter fullscreen mode Exit fullscreen mode

Here is my pubspec.yaml file

dependencies:

  cloud_firestore:

  flutter:
    sdk: flutter
Enter fullscreen mode Exit fullscreen mode

Solutions

Here is All Possible Solution added please visit [Solved] Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536)

Top comments (0)