Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 505 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Execution failed for task ':app:mergeDexDebug'. Firestore | Flutter

#1
Trying to use Firestore in my project. My project is a brand new one, but having problems running the app on my device without getting an error:
**Execution failed for task ':app:mergeDexDebug'.**

My app is using AndroidX. I've added my google-services.json file, followed the steps etc.

Yaml file:

dependencies:
cloud_firestore: ^0.13.3
android/build.gradle:

com.google.gms:google-services:4.3.3

Full error:

>FAILURE: Build failed with an exception.

> What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at

[To see links please register here]

Reply

#2
Fixed the issue, but don't understand why. Why do I need to enable multiDex when I believe Firestore is using AndroidX?

Anyway, the fix. Add **multiDexEnabled true** to your **app/build.gradle**

defaultConfig {
// TODO: Specify your own unique Application ID
(

[To see links please register here]

).
applicationId "com.example.poll"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
//This line here...
multiDexEnabled true
}
Reply

#3
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:

[To see links please register here]


add multiDexEnabled true in app/build.gradle defaultConfig at last.

`defaultConfig{
...
multiDexEnabled true
}`
Reply

#4
You can follow the **guidelines** mentioned here

[To see links please register here]


or to cut the story short and directly go to answer

Find `android/app/build.gradle` file and add the following lines of codes:

dependencies {
compile 'com.android.support:multidex:1.0.3'
//find latest version from here

[To see links please register here]

}

android {
defaultConfig {
multiDexEnabled true
}
}
Reply

#5
If you are using AndroidX,

Add below lines to **app/build.gradle**

`multiDexEnabled true // to the defaultConfig {}`

`implementation 'androidx.multidex:multidex:2.0.1' // to the dependencies`


To the AndroidManifest.xml (Optional)

<application
android:name="androidx.multidex.MultiDexApplication"

Please note that you have to extends `MainActivity` to the `MultiDexApplication`. If you change `android:name`.
Reply

#6
I just met with this error, and it turns out it can be fixed easily. Of course, other answers on this are really great and it tells you how to fix it. However, I was wondering why this even happened. It turns out this comes from the **`minSdkVersion`** used. If this is set to **`20`** or lower, you need to configure your app for multiDex support.

defaultConfig {
applicationId "com.inspire.aaym"
minSdkVersion 21
targetSdkVersion 30
}
So, if you app is not intended to be used in Android version prior to 5.0, setting the **`minSdkVersion`** number to `21` will easily fix this issue. If not, follow the workaround to enable mutiDex support.

Read more from the official document:
[

[To see links please register here]

][1]


[1]:

[To see links please register here]

Reply

#7
in app/build.gradle make sure your minSdkVersion should be greater or equal to 21

defaultConfig {

minSdkVersion 21

targetSdkVersion 30

versionCode flutterVersionCode.toInteger()

versionName flutterVersionName

}
Reply

#8
# In 2022 : Execution failed for task ':app:mergeExtDexDebug'. Solved it by Changing: #
```
android {
compileSdkVersion 29

compileOptions {
sourceCompatibility kotlin_version
targetCompatibility kotlin_version
}
```
# To #
```
android {
compileSdkVersion 29

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
```
And Also Added:
```
multiDexEnabled true
```
to
```
defaultConfig {

}
```
Reply

#9
this error when test Device is Change!Clear Build folder from project and rerun again.good lock
Reply

#10
The problem is with multidex builder. Actually, this often happens when you have imported a lot of packages in your yaml file which cannot fit into a single .dex built hence you have to enable multidex.

Go to android/app/build.gradle and add the following lines of code:
```
dependencies {
implementation 'com.android.support:multidex:2.0.1' //enter the latest multidex version
}
android {
defaultConfig {
multiDexEnabled true
}
}
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through