A failure occurred while executing com.android.build.gradle.internal.tasks
Solution 1:
Finally found a solution for this by adding this line to gradle.properties.
org.gradle.jvmargs=-Xmx4608m
Solution 2:
Try this, in Android Studio
File > Invalidate Caches/Restart...
Solution 3:
I already had multidex enabled but the version was too old so upgraded and it fixed the issue:
// Old version
implementation "com.android.support:multidex:1.0.3"
// New version
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
Solution 4:
In my case, I enabled multidex
Open [project_folder]/app/build.gradle
and add following lines.
defaultConfig {
...
multiDexEnabled true
}
and
dependencies {
...
implementation 'com.android.support:multidex:2.0.1'
}
Solution 5:
I removed this issue by adding the following lines
add
multiDexEnabled true
in android>app>build.gradle inside defaultConfigadd
implementation 'com.android.support:multidex:1.0.3'
in android>app>build.gradle inside dependencies