【问题标题】:An error pops up when building an APK构建APK时弹出错误
【发布时间】:2017-11-13 06:05:36
【问题描述】:

错误:任务 ':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/auth/api/signin/internal/zzg;

当我尝试构建 APK 时会显示此错误消息。 这是什么意思?我该如何解决?

这些是我的依赖项:

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-storage:10.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.sillebille:dynamic-calendar:1.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.firebaseui:firebase-ui:0.6.2'
testCompile 'junit:junit:4.12'

【问题讨论】:

标签: java android android-studio apk


【解决方案1】:

'com.firebaseui:firebase-ui:0.6.2' 更改为 'com.firebaseui:firebase-ui:1.2.0' 并添加 编译'com.android.support:multidex:1.0.1'

应用构建.gradle

android {
    defaultConfig {
         // whats ever
         multiDexEnabled true
    }
}

// whats ever

dependencies {
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.gms:play-services-maps:10.2.0'
    compile 'com.android.support:design:25.3.1'
    compile 'com.google.firebase:firebase-database:10.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:support-vector-drawable:25.3.1'
    compile 'com.google.firebase:firebase-auth:10.2.0'
    compile 'com.google.firebase:firebase-storage:10.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.sillebille:dynamic-calendar:1.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.firebaseui:firebase-ui:1.2.0'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'
}

并添加到您的项目 build.gradle

allprojects {
    repositories {
    // whats ever
    maven { url 'https://maven.fabric.io/public' }
}

AndroidManifest.xml

<application
    android:name="android.support.multidex.MultiDexApplication"

【讨论】:

    猜你喜欢
    • 2018-08-13
    • 1970-01-01
    • 1970-01-01
    • 2016-08-10
    • 2018-09-28
    • 1970-01-01
    • 2022-10-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多