android - Android:合并Google Play服务位置和apache commons.io时无法合并dex

标签 android gradle google-play-services dex apache-commons-io

当我尝试使用下面的gradle文件运行一个(新创建的)Android应用程序时,出现以下错误:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex


但是,当我删除commons-io依赖性时,一切正常。您能给我一个提示,为什么存在冲突以及如何解决冲突?
//build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "my.application"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    implementation 'com.google.android.gms:play-services-location:11.8.0'

    implementation group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
}

最佳答案

对我来说,这是由于不同依赖项中的版本不匹配而发生的。尝试更改它们。

关于android - Android:合并Google Play服务位置和apache commons.io时无法合并dex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49283184/

相关文章:

android - Genymotion 虚拟机将 Theme.Holo.DialogWhenLarge 主题 Activity 显示为正常 Activity

android - 我如何使用 sonic ndk android 播放 mp3/wav?

android - Gradle 进程 list 与新的 Manifest Merger

android - 在使用 Google Apps 帐户登录时,在 Android 上对 Google Play 游戏服务进行身份验证会导致错误

android - 使用 appcompat-v7 在 Actionmode 中自定义 'back' 箭头颜色

gradle - Lombok 的 val 推断的类型的复杂性是否有限制?

java - 构建我的 Android ReactJs Native 应用程序时遇到问题

android - Google Play 服务库更新和缺少符号 @integer/google_play_services_version

android - Google 附近连接 Api - 不幸的是 Play 服务已停止

android - 移动形式的全息图,可防止垃圾邮件发送者