close

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

Hello Guys. Many times we Face Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) in Android Studio. So in this tutorial, we are going to solve this error.

What is Error ?

I am facing this error when I Use firestore with flutter app.

Question: How to solve Flutter Firestore causing D8: Cannot fit requested classes in a single dex ?
Answer: By default, Flutter supports Android SDK v16 (Jelly Bean, released 2012), but multidex doesn’t really work with Jelly Bean out of the box. So we have to do 2 task to solve this error.

How to solve Flutter Firestore causing D8: Cannot fit requested classes in a single dex ?

By default, Flutter supports Android SDK v16 (Jelly Bean, released 2012), but multidex doesn’t really work with Jelly Bean out of the box.

So we have to do 2 task to solve this error.

  1. Change minimum target SDK
  1. Open android/app/build.gradle, then find the line that says minSdkVersion 16.
  2. Change that line to minSdkVersion 21.
  3. Save the file.

2. Enable multidex.

  1. Open and modify project/app/build.gradle file to enable multidex and add the multidex library as a dependency, as shown here :

Here is official Document Official guide.

Solution 2

Enable multidex.

Open project/app/build.gradle and add the following lines.

then

If you have migrated to AndroidX, you’ll want this instead.

Now, Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) in Android Studio Error is solved. If you still facing this error so Comment below your error with code. I Will Help You. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.

Also Read

Leave a Comment

%d bloggers like this: