【问题标题】:Getting error "Execution failed for task ':app:transformClassesWithDexForDebug"收到错误“任务执行失败:app:transformClassesWithDexForDebug”
【发布时间】:2017-04-28 23:18:00
【问题描述】:

需要帮助。

错误:任务 ':app:transformClassesWithDexForDebug' 执行失败。 > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: 多个dex文件定义Lcom/google/android /gms/inte

应用程序在 api 级别 23 上运行,但在 api 16 上出现上述错误,这是我的 minsdk。

我的 gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
    applicationId "com.example.raghavkishan.financialplanner"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

谢谢。

【问题讨论】:

  • 我尝试了那里提到的解决方案,但没有奏效。
  • @RaghavKishan 您关注的时候出现了什么错误?请始终提供完整的错误响应。
  • @Sufian 报错同上。我只使用了一个 google play services 依赖项,它是 Auth 依赖项。

标签: java android android-studio android-gradle-plugin android-authenticator


【解决方案1】:

首先清理项目并重建,然后在项目的应用级 build.gradle 文件中添加以下代码: defaultConfig { multiDexEnabled true }

在您的 build.gradle 文件中, 依赖项包含以下几行:

compile 'com.google.firebase:firebase-auth:10.2.1' compile 'com.google.firebase:firebase-database:10.0.1' compile 'com.google.android.gms:play-services-auth:10.2.1'

改为以下几行:

compile 'com.google.firebase:firebase-auth:10.2.1' compile 'com.google.firebase:firebase-database:10.2.1' compile 'com.google.android.gms:play-services-auth:10.2.1'

只要确保每个版本都有相同的值。

【讨论】:

  • 我得到的错误是:“错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。> com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/internal/zzblr.class "
猜你喜欢
  • 2016-05-24
  • 2017-09-01
  • 1970-01-01
  • 2017-09-13
  • 1970-01-01
  • 1970-01-01
  • 2017-01-10
  • 1970-01-01
  • 2018-02-17
相关资源
最近更新 更多