Error:Execution failed for task ‘: app:transformDexArchiveWithExternalLibsDexMergerForDebug The solution

specific error message is as follows:

AGPBI: {"kind":"error","text":"Program type already present:$1","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED

there are several methods (the last one is available) :

1. Add “multiDexEnabled true” to defaultConfig

android {} :

defaultConfig {
        multiDexEnabled true
        applicationId "com.example.m1571.mycolorfulnews"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner ""

this method has no effect on my project

2. Add:

to gradle. Properties China


this method has no effect on my project

3. Remove conflicting dependencies:

implementation ''

delete the above v7 package, you can run

Read More: