java.util.zip.ZipException:重复条目:android / arch / lifecycle / LiveData $ 1.class

meh*_*met 1 java android apk android-gradle-plugin

好吧,我可以在调试模式下在设备上运行我的应用程序,没有问题,但是如果我想生成签名的apk,则会出现此错误

错误:任务':app:transformDexWithDexForRelease'的执行失败。

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.dex.DexException:多个dex文件定义了Landroid / arch / lifecycle / LiveData $ 1;

我实际上不了解什么是“ LiveData.class”

这是我的依赖:

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    //arayüz
    implementation  'com.android.support:appcompat-v7:27.1.0'
    implementation  'com.android.support:palette-v7:27.1.0'
    implementation  'com.android.support:cardview-v7:27.1.0'
    implementation  'com.android.support:recyclerview-v7:27.1.0'
    implementation  'com.android.support:support-v4:27.1.0'
    implementation  'com.android.support:design:27.1.0'
    implementation  'com.android.support.constraint:constraint-layout:1.0.2'

    //firebase
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.firebaseui:firebase-ui-storage:3.2.1'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-config:11.8.0'
    implementation 'com.firebaseui:firebase-ui-database:3.0.0'

    //metariel View Pager
    implementation 'com.github.florent37:materialviewpager:1.2.3'

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

Non*_*hoi 5

这可能是由于依赖性版本不匹配而发生的。这里有一个类似的问题,我检查了它的依赖树:

android.arch.lifecycle:extensions:1.0.0-beta1
Run Code Online (Sandbox Code Playgroud)

android.arch.lifecycle:livedata-core:1.1.0
Run Code Online (Sandbox Code Playgroud)

看到不匹配1.0.01.1.0

在您的情况下,请尝试更新:

implementation 'com.firebaseui:firebase-ui-storage:3.2.1'
implementation 'com.firebaseui:firebase-ui-database:3.0.0'
Run Code Online (Sandbox Code Playgroud)

至:

implementation 'com.firebaseui:firebase-ui-storage:3.2.2'
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
Run Code Online (Sandbox Code Playgroud)

有望解决该问题。

我实际上不了解什么是“ LiveData.class”

请阅读