错误:任务执行失败':app:transformDexArchiveWithExternalLibsDexMergerForDebug

时间:2017-12-28 12:08:17

标签: java android

这是依赖

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile group: 'io.nlopez.smartlocation', name: 'library', version: '3.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.gms:play-services-location:11.4.2'
    compile 'com.google.android.gms:play-services-base:11.4.2'
    compile 'com.google.android.gms:play-services-maps:11.4.2'
    compile 'com.github.arimorty:floatingsearchview:2.1.1'
    compile 'com.jota.autocompletelocation:autocomplete-location:0.9.0'
    testCompile 'junit:junit:4.12'
}

当我运行我的应用程序时出现此错误。

  

错误:任务执行失败   ':应用程序:transformDexArchiveWithExternalLibsDexMergerForDebug'。

     
    

com.android.builder.dexing.DexArchiveMergerException:com.android.tools.r8.errors.CompilationError:程序类型已经     目前:com.google.android.gms.internal.zzbcg

  

我该怎么办?

2 个答案:

答案 0 :(得分:0)

替换implementation 'com.android.support.constraint:constraint-layout:1.0.2'

使用compile 'com.android.support.constraint:constraint-layout:1.0.2',如下面的代码

    dependencies {

    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile group: 'io.nlopez.smartlocation', name: 'library', version: '3.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.gms:play-services-location:11.4.2'
    compile 'com.google.android.gms:play-services-base:11.4.2'
    compile 'com.google.android.gms:play-services-maps:11.4.2'
    compile 'com.github.arimorty:floatingsearchview:2.1.1'
    compile 'com.jota.autocompletelocation:autocomplete-location:0.9.0'
    testCompile 'junit:junit:4.12'
}

答案 1 :(得分:0)

如果清洁项目没有帮助,我建议您删除这些文件夹

  • \构建
  • .idea
  • .gradle
  • 应用\构建

然后重建项目。