Top 26 Cannot Fit Requested Classes In A Single Dex File Top Answer Update

You are looking for information, articles, knowledge about the topic nail salons open on sunday near me cannot fit requested classes in a single dex file on Google, you do not find the information you need! Here are the best content compiled and compiled by the https://chewathai27.com/to team, along with other related topics such as: cannot fit requested classes in a single dex file Cannot fit requested classes in a single dex file flutter, Cannot fit requested classes in a single dex file Unity, manifest merger failed with multiple errors, see logs, Agpbi kind error text cannot fit requested classes in a single dex file, com android tools r8 internal b cannot fit requested classes in a single dex file, Multidex Android, D8: Cannot fit requested classes in a single dex file, No file known for classes dex


Cannot fit requested classes in a single dex file (# methods 76116 65536) How to solve
Cannot fit requested classes in a single dex file (# methods 76116 65536) How to solve


android – Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536 – Stack Overflow

  • Article author: stackoverflow.com
  • Reviews from users: 26232 ⭐ Ratings
  • Top rated: 3.1 ⭐
  • Lowest rated: 1 ⭐
  • Summary of article content: Articles about android – Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536 – Stack Overflow Reason for this exception: The DEX specification limits the total number of methods that can be referenced within a single DEX file to 65,536 ( … …
  • Most searched keywords: Whether you are looking for android – Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536 – Stack Overflow Reason for this exception: The DEX specification limits the total number of methods that can be referenced within a single DEX file to 65,536 ( …
  • Table of Contents:

29 Answers
29

In Gradle build file add dependency

And then in the defaultConfig section add

Not the answer you’re looking for Browse other questions tagged android android-multidex or ask your own question

android - Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536 – Stack Overflow” style=”width:100%”><figcaption>android – Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536 – Stack Overflow</figcaption></figure>
<p style=Read More

[Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list – Exception Error

  • Article author: exerror.com
  • Reviews from users: 17811 ⭐ Ratings
  • Top rated: 3.9 ⭐
  • Lowest rated: 1 ⭐
  • Summary of article content: Articles about [Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list – Exception Error To Solve Cannot fit requested es in a single dex file. Try supplying a main-dex list Error You just need to Add dependency androx. …
  • Most searched keywords: Whether you are looking for [Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list – Exception Error To Solve Cannot fit requested es in a single dex file. Try supplying a main-dex list Error You just need to Add dependency androx. To Solve Cannot fit requested classes in a single dex file. Try supplying a main-dex list Error You just need to Add dependency androidx.multi
  • Table of Contents:

How This Error Occurs

How To Solve Cannot fit requested classes in a single dex file Try supplying a main-dex list Error

Solution 1 Add dependency in buildgradle

Solution 2 Androidx Users

Summary

Quick Links

Category

[Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list - Exception Error
[Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list – Exception Error

Read More

[Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list – Exception Error

  • Article author: www.codegrepper.com
  • Reviews from users: 32395 ⭐ Ratings
  • Top rated: 3.1 ⭐
  • Lowest rated: 1 ⭐
  • Summary of article content: Articles about [Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list – Exception Error Answers related to “Cannot fit requested es in a single dex file”. No Java files found that extend CordovaActivity. [ERROR] An error occurred while … …
  • Most searched keywords: Whether you are looking for [Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list – Exception Error Answers related to “Cannot fit requested es in a single dex file”. No Java files found that extend CordovaActivity. [ERROR] An error occurred while … To Solve Cannot fit requested classes in a single dex file. Try supplying a main-dex list Error You just need to Add dependency androidx.multi
  • Table of Contents:

How This Error Occurs

How To Solve Cannot fit requested classes in a single dex file Try supplying a main-dex list Error

Solution 1 Add dependency in buildgradle

Solution 2 Androidx Users

Summary

Quick Links

Category

[Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list - Exception Error
[Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list – Exception Error

Read More

Cannot fit requested classes in a single dex file | B4X Programming Forum

  • Article author: www.b4x.com
  • Reviews from users: 40530 ⭐ Ratings
  • Top rated: 4.2 ⭐
  • Lowest rated: 1 ⭐
  • Summary of article content: Articles about Cannot fit requested classes in a single dex file | B4X Programming Forum Hello! I updated to 11.50 today but when I try to compile I’m having this error Dex code (1.20s) Dex merge Error Error: Cannot fit requested … …
  • Most searched keywords: Whether you are looking for Cannot fit requested classes in a single dex file | B4X Programming Forum Hello! I updated to 11.50 today but when I try to compile I’m having this error Dex code (1.20s) Dex merge Error Error: Cannot fit requested … Hello!
    I updated to 11.50 today but when I try to compile I’m having this error
    Dex code (1.20s)
    Dex merge Error
    Error: Cannot fit requested classes…
  • Table of Contents:
Cannot fit requested classes in a single dex file | B4X Programming Forum
Cannot fit requested classes in a single dex file | B4X Programming Forum

Read More

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

  • Article author: dtuto.com
  • Reviews from users: 11616 ⭐ Ratings
  • Top rated: 3.7 ⭐
  • Lowest rated: 1 ⭐
  • Summary of article content: Articles about Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) in Android Studio – Dtuto Flutter Firestore causing D8: Cannot fit requested es in a single dex file (# methods: 71610 > 65536) in Andro Studio Change minimum target SDK Open … …
  • Most searched keywords: Whether you are looking for Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) in Android Studio – Dtuto Flutter Firestore causing D8: Cannot fit requested es in a single dex file (# methods: 71610 > 65536) in Andro Studio Change minimum target SDK Open … Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) in Android Studio Change minimum target SDK Open android/app/build.gradle, then find the line that says minSdkVersion 16. Change that line to minSdkVersion 21. Save the file. Enable multidex. If you want to support older Android versions you can use the multidex support library. Open and modify project/app/build.gradle file to enable multidex and add the multidex library as a dependency, as shown here : android { defaultConfig { … multiDexEnabled true } … } dependencies { implementation 'com.android.support:multidex:1.0.3' }Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) in Android Studio
  • Table of Contents:
Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) in Android Studio – Dtuto” style=”width:100%”><figcaption>Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) in Android Studio – Dtuto</figcaption></figure>
<p style=Read More

Enable multidex for apps with over 64K methods  |  Android Developers

  • Article author: developer.android.com
  • Reviews from users: 2937 ⭐ Ratings
  • Top rated: 4.7 ⭐
  • Lowest rated: 1 ⭐
  • Summary of article content: Articles about Enable multidex for apps with over 64K methods  |  Android Developers ART performs pre-compilation at app install time which scans for es N .dex files and compiles them into a single .oat file for execution by … …
  • Most searched keywords: Whether you are looking for Enable multidex for apps with over 64K methods  |  Android Developers ART performs pre-compilation at app install time which scans for es N .dex files and compiles them into a single .oat file for execution by … Learn how to enable an app configuration known as multidex, which allows your app to build and read multiple DEX files.
  • Table of Contents:

About the 64K reference limit

Avoid the 64K limit

Configure your app for multidex

Declare classes required in the primary DEX file

Optimize multidex in development builds

Test multidex apps

Enable multidex for apps with over 64K methods  |  Android Developers
Enable multidex for apps with over 64K methods  |  Android Developers

Read More

Page not found

  • Article author: lightrun.com
  • Reviews from users: 753 ⭐ Ratings
  • Top rated: 3.9 ⭐
  • Lowest rated: 1 ⭐
  • Summary of article content: Articles about Page not found CompatDx.main(CompatDx.java:472) Caused by: com.andro.tools.r8.internal.f: Cannot fit requested es in a single dex file (# methods: 227417 > 65536 … …
  • Most searched keywords: Whether you are looking for Page not found CompatDx.main(CompatDx.java:472) Caused by: com.andro.tools.r8.internal.f: Cannot fit requested es in a single dex file (# methods: 227417 > 65536 … java, exceptions, errorsLightrun Answers. Where developers land when they google for errors and exceptions
  • Table of Contents:
Page not found
Page not found

Read More

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

  • Article author: dev.to
  • Reviews from users: 46421 ⭐ Ratings
  • Top rated: 4.5 ⭐
  • Lowest rated: 1 ⭐
  • Summary of article content: Articles about [Solved] Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) – DEV Community D8: Cannot fit requested es in a single dex file (# methods: 71610 > 65536) FAILURE: Build failed with an exception. …
  • Most searched keywords: Whether you are looking for [Solved] Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) – DEV Community D8: Cannot fit requested es in a single dex file (# methods: 71610 > 65536) FAILURE: Build failed with an exception. Hello Guys, How are you all ? Hope you all are fine. While I am attempting to use firestore with a Fl…software, coding, development, engineering, inclusive, community
  • Table of Contents:

DEV Community

DEV Community is a community of 881839 amazing developers

Other

Discussion (0)

Read next

[Solved] Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) – DEV Community” style=”width:100%”><figcaption>[Solved] Flutter Firestore causing D8: Cannot fit requested classes in a single dex file (# methods: 71610 > 65536) – DEV Community</figcaption></figure>
<p style=Read More


See more articles in the same category here: https://chewathai27.com/to/blog.

[Solved] Cannot fit requested classes in a single dex file. Try supplying a main-dex list

Hello Guys, How are you all? Hope You all Are Fine. Today Cannot fit requested classes in a single dex file. Try supplying a main-dex list in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How This Error Occurs ?

I am facing following error while run my app.

Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

# methods: 68061 > 65536 Message{kind=ERROR, text=Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

How To Solve Cannot fit requested classes in a single dex file. Try supplying a main-dex list Error ?

How To Solve Cannot fit requested classes in a single dex file. Try supplying a main-dex list Error ? To Solve Cannot fit requested classes in a single dex file. Try supplying a main-dex list Error You just need to Add dependency androidx.multidex:multidex:2.0.1 in build.gradle file. Just like this: implementation ‘androidx.multidex:multidex:2.0.1’ And also You need to set multiDexEnabled to true In build.gradle ‘s defaultConfig section add: multiDexEnabled true Now Your error must be solved. Cannot fit requested classes in a single dex file. Try supplying a main-dex list To Solve Cannot fit requested classes in a single dex file. Try supplying a main-dex list Error You just need to Add dependency androidx.multidex:multidex:2.0.1 in build.gradle file. Just like this: implementation ‘androidx.multidex:multidex:2.0.1’ And also You need to set multiDexEnabled to true In build.gradle ‘s defaultConfig section add: multiDexEnabled true Now Your error must be solved.

Solution 1: Add dependency in build.gradle

You just need to Add dependency androidx.multidex:multidex:2.0.1 in build.gradle file. Just like this.

implementation ‘androidx.multidex:multidex:2.0.1’

And also You need to set multiDexEnabled to true In build.gradle ‘s defaultConfig section add.

android { defaultConfig { … minSdkVersion 21 <----- *OPTIONAL targetSdkVersion 26 multiDexEnabled true <------ *here } ... } Now Your error must be solved. Solution 2: Androidx Users dependencies { implementation 'androidx.multidex:multidex:2.0.1' } defaultConfig { minSdkVersion 16 targetSdkVersion 28 multiDexEnabled true //ADD THIS LINE } Summary It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Also, Read

Enable multidex for apps with over 64K methods

When your app and the libraries it references exceed 65,536 methods, you encounter a build error that indicates your app has reached the limit of the Android build architecture:

trouble writing output: Too many field references: 131000; max is 65536. You may try using –multi-dex option.

Older versions of the build system report a different error, which is an indication of the same problem:

Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

Both these error conditions display a common number: 65536. This number represents the total number of references that can be invoked by the code within a single Dalvik Executable (DEX) bytecode file. This page explains how to move past this limitation by enabling an app configuration known as multidex, which allows your app to build and read multiple DEX files.

About the 64K reference limit

Android app (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536—including Android framework methods, library methods, and methods in your own code. In the context of computer science, the term Kilo, K, denotes 1024 (or 2^10). Because 65,536 is equal to 64 X 1024, this limit is referred to as the ’64K reference limit’.

Multidex support prior to Android 5.0

Versions of the platform prior to Android 5.0 (API level 21) use the Dalvik runtime for executing app code. By default, Dalvik limits apps to a single classes.dex bytecode file per APK. In order to get around this limitation, you can add the multidex library to the module-level build.gradle file:

Groovy dependencies { def multidex_version = “2.0.1” implementation “androidx.multidex:multidex:$multidex_version” } Kotlin dependencies { val multidex_version = “2.0.1” implementation(“androidx.multidex:multidex:$multidex_version”) }

To view the current versions for this library, see the information about Multidex on the versions page.

If you aren’t using AndroidX, add the following deprecated support library dependency instead:

Groovy dependencies { implementation ‘com.android.support:multidex:1.0.3’ } Kotlin dependencies { implementation(“com.android.support:multidex:1.0.3”) }

This library becomes part of the primary DEX file of your app and then manages access to the additional DEX files and the code they contain. More details are below in the section about how to configure your app for multidex.

Multidex support for Android 5.0 and higher

Android 5.0 (API level 21) and higher uses a runtime called ART which natively supports loading multiple DEX files from APK files. ART performs pre-compilation at app install time which scans for classes N .dex files and compiles them into a single .oat file for execution by the Android device. Therefore, if your minSdkVersion is 21 or higher multidex is enabled by default, and you do not need the multidex library.

For more information on the Android 5.0 runtime, read ART and Dalvik.

Note: When running your app using Android Studio, the build is optimized for the target devices you deploy to. This includes enabling multidex when the target devices are running Android 5.0 and above. Because this optimization is applied only when deploying your app using Android Studio, you might still need to configure your release build for multidex to avoid the 64K limit.

Avoid the 64K limit

Before configuring your app to enable use of 64K or more method references, you should take steps to reduce the total number of references called by your app code, including methods defined by your app code or included libraries. The following strategies can help you avoid hitting the DEX reference limit:

Review your app’s direct and transitive dependencies – Ensure any large library dependency you include in your app is used in a manner that outweighs the amount of code being added to the app. A common anti-pattern is to include a very large library because a few utility methods were useful. Reducing your app code dependencies can often help you avoid the DEX reference limit.

– Ensure any large library dependency you include in your app is used in a manner that outweighs the amount of code being added to the app. A common anti-pattern is to include a very large library because a few utility methods were useful. Reducing your app code dependencies can often help you avoid the DEX reference limit. Remove unused code with R8 – Enable code shrinking to run R8 for your release builds. Enabling shrinking ensures you are not shipping unused code with your APKs.

Using these techniques might help you avoid the need to enable multidex in your app while also decreasing the overall size of your APK.

Configure your app for multidex

If your minSdkVersion is set to 21 or higher, multidex is enabled by default and you do not need the multidex library.

However, if your minSdkVersion is set to 20 or lower, then you must use the multidex library and make the following modifications to your app project:

Modify the module-level build.gradle file to enable multidex and add the multidex library as a dependency, as shown here: Groovy android { defaultConfig { … minSdkVersion 15 targetSdkVersion 28 multiDexEnabled true } … } dependencies { implementation “androidx.multidex:multidex:2.0.1” } Kotlin android { defaultConfig { … minSdk = 15 targetSdk = 28 multiDexEnabled = true } … } dependencies { implementation(“androidx.multidex:multidex:2.0.1”) } Depending on whether you override the Application class, perform one of the following: If you do not override the Application class, edit your manifest file to set android:name in the tag as follows:

If you do override the Application class, change it to extend MultiDexApplication (if possible) as follows: Kotlin class MyApplication : MultiDexApplication() {…} Java public class MyApplication extends MultiDexApplication { … }

Or if you do override the Application class but it’s not possible to change the base class, then you can instead override the attachBaseContext() method and call MultiDex.install(this) to enable multidex: Kotlin class MyApplication : SomeOtherApplication() { override fun attachBaseContext(base: Context) { super.attachBaseContext(base) MultiDex.install(this) } } Java public class MyApplication extends SomeOtherApplication { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } } Caution: Do not execute MultiDex.install() or any other code through reflection or JNI before MultiDex.install() is complete. Multidex tracing will not follow those calls, causing ClassNotFoundException or verify errors due to a bad class partition between DEX files.

Now when you build your app, the Android build tools construct a primary DEX file ( classes.dex ) and supporting DEX files ( classes2.dex , classes3.dex , and so on) as needed. The build system then packages all DEX files into your APK.

At runtime, the multidex APIs use a special class loader to search all of the available DEX files for your methods (instead of searching only in the main classes.dex file).

Limitations of the multidex library

The multidex library has some known limitations that you should be aware of and test for when you incorporate it into your app build configuration:

The installation of DEX files during startup onto a device’s data partition is complex and can result in Application Not Responding (ANR) errors if the secondary DEX files are large. To avoid this issue, enable code shrinking to minimize the size of DEX files and remove unused portions of code.

When running on versions prior to Android 5.0 (API level 21), using multidex is not enough to work around the linearalloc limit (issue 78035). This limit was increased in Android 4.0 (API level 14), but that did not solve it completely. And on versions lower than Android 4.0, you might reach the linearalloc limit before reaching the DEX index limit. So if you are targeting API levels lower than 14, test thoroughly on those versions of the platform, because your app might have issues at startup or when particular groups of classes are loaded. Code shrinking can reduce or possibly eliminate these issues.

Declare classes required in the primary DEX file

When building each DEX file for a multidex app, the build tools perform complex decision-making to determine which classes are needed in the primary DEX file so that your app can start successfully. If any class that’s required during startup is not provided in the primary DEX file, then your app crashes with the error java.lang.NoClassDefFoundError .

This shouldn’t happen for code that’s accessed directly from your app code because the build tools recognize those code paths, but it can happen when the code paths are less visible such as when a library you use has complex dependencies. For example, if the code uses introspection or invocation of Java methods from native code, then those classes might not be recognized as required in the primary DEX file.

So if you receive java.lang.NoClassDefFoundError , then you must manually specify these additional classes as required in the primary DEX file by declaring them with the multiDexKeepFile or the multiDexKeepProguard property in your build type. If a class is matched in either the multiDexKeepFile or the multiDexKeepProguard file, then that class is added to the primary DEX file.

multiDexKeepFile property

The file you specify in multiDexKeepFile should contain one class per line, in the format com/example/MyClass.class . For example, you can create a file called multidex-config.txt that looks like this:

com/example/MyClass.class com/example/MyOtherClass.class

Then you can declare that file for a build type as follows:

Groovy android { buildTypes { release { multiDexKeepFile file(‘multidex-config.txt’) … } } } Kotlin android { buildTypes { getByName(“release”) { multiDexKeepFile = file(‘multidex-config.txt’) … } } }

Remember that Gradle reads paths relative to the build.gradle file, so the above example works if multidex-config.txt is in the same directory as the build.gradle file.

multiDexKeepProguard property

The multiDexKeepProguard file uses the same format as Proguard and supports the entire Proguard grammar. For more information about Proguard format and grammar, see the Keep Options section in the Proguard manual.

The file you specify in multiDexKeepProguard should contain -keep options in any valid ProGuard syntax. For example, -keep com.example.MyClass.class . You can create a file called multidex-config.pro that looks like this:

-keep class com.example.MyClass -keep class com.example.MyClassToo

If you want to specify all classes in a package, the file looks like this:

-keep class com.example.** { *; } // All classes in the com.example package

Then you can declare that file for a build type as follows:

Groovy android { buildTypes { release { multiDexKeepProguard file(‘multidex-config.pro’) … } } } Kotlin android { buildTypes { getByName(“release”) { multiDexKeepProguard = file(‘multidex-config.pro’) … } } }

Optimize multidex in development builds

A multidex configuration requires significantly increased build processing time because the build system must make complex decisions about which classes must be included in the primary DEX file and which classes can be included in secondary DEX files. This means that incremental builds using multidex typically take longer and can potentially slow your development process.

To mitigate longer incremental build times, you should use pre-dexing to reuse multidex output between builds. Pre-dexing relies on an ART format available only on Android 5.0 (API level 21) and higher. If you’re using Android Studio 2.3 and higher, the IDE automatically uses this feature when deploying your app to a device running Android 5.0 (API level 21) or higher.

Tip: Android plugin for Gradle 3.0.0 and higher include further improvements to optimize build speeds, such as per-class dexing (so that only the classes that you modify are re-dexed). In general, for the best development experience, you should always upgrade to the latest version of Android Studio and the Android plugin.

However, if you’re running Gradle builds from the command line, you need to set the minSdkVersion to 21 or higher to enable pre-dexing. A helpful strategy to preserve settings for your production build is to create two versions of your app using product flavors: a development flavor and a release flavor with different values for minSdkVersion , as shown below.

Groovy android { defaultConfig { … multiDexEnabled true // The default minimum API level you want to support. minSdkVersion 15 } productFlavors { // Includes settings you want to keep only while developing your app. dev { // Enables pre-dexing for command line builds. When using // Android Studio 2.3 or higher, the IDE enables pre-dexing // when deploying your app to a device running Android 5.0 // (API level 21) or higher—regardless of what you set for // minSdkVersion. minSdkVersion 21 } prod { // If you’ve configured the defaultConfig block for the production version of // your app, you can leave this block empty and Gradle uses configurations in // the defaultConfig block instead. You still need to include this flavor. // Otherwise, all variants use the “dev” flavor configurations. } } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’ } } } dependencies { implementation “androidx.multidex:multidex:2.0.1” } Kotlin android { defaultConfig { … multiDexEnabled = true // The default minimum API level you want to support. minSdk = 15 } productFlavors { // Includes settings you want to keep only while developing your app. create(“dev”) { // Enables pre-dexing for command line builds. When using // Android Studio 2.3 or higher, the IDE enables pre-dexing // when deploying your app to a device running Android 5.0 // (API level 21) or higher—regardless of what you set for // minSdkVersion. minSdk = 21 } create(“prod”) { // If you’ve configured the defaultConfig block for the production version of // your app, you can leave this block empty and Gradle uses configurations in // the defaultConfig block instead. You still need to include this flavor. // Otherwise, all variants use the “dev” flavor configurations. } } buildTypes { getByName(“release”) { isMinifyEnabled = true proguardFiles(getDefaultProguardFile(“proguard-android.txt”), “proguard-rules.pro”) } } } dependencies { implementation(“androidx.multidex:multidex:2.0.1”) }

To learn more strategies to help improve build speeds (from either Android Studio or the command line), read Optimize Your Build Speed. For more information about using build variants, see Configure Build Variants.

Tip: Now that you have different build variants for different multidex needs, you can also provide a different manifest file for each variant (so only the one for API level 20 and lower changes the tag name), or create a different Application subclass for each variant (so only the one for API level 20 and lower extends the MultiDexApplication class or calls MultiDex.install(this) ).

Test multidex apps

When you write instrumentation tests for multidex apps, no additional configuration is required if you use a MonitoringInstrumentation (or an AndroidJUnitRunner ) instrumentation. If you use another Instrumentation , then you must override its onCreate() method with the following code:

Kotlin fun onCreate(arguments: Bundle) { MultiDex.install(targetContext) super.onCreate(arguments) … } Java public void onCreate(Bundle arguments) { MultiDex.install(getTargetContext()); super.onCreate(arguments); … }

[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)

So you have finished reading the cannot fit requested classes in a single dex file topic article, if you find this article useful, please share it. Thank you very much. See more: Cannot fit requested classes in a single dex file flutter, Cannot fit requested classes in a single dex file Unity, manifest merger failed with multiple errors, see logs, Agpbi kind error text cannot fit requested classes in a single dex file, com android tools r8 internal b cannot fit requested classes in a single dex file, Multidex Android, D8: Cannot fit requested classes in a single dex file, No file known for classes dex

Leave a Comment