尝试生成apk时,android studio中的livesata $ 1.class重复输入错误[关闭]

问题描述 投票:5回答:1

我真的不知道是什么导致了这个错误以及如何解决它

我的所有依赖:

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-firestore:11.8.0'
implementation 'com.firebaseui:firebase-ui-firestore:3.2.1'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation ('com.facebook.android:facebook-android-sdk:4.31.0'){exclude group: 'com.android.support'}
implementation'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:recyclerview-v7:27.1.0'

compile 'com.airbnb.android:lottie:2.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'

compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
compile 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:design:27.1.0'
compile 'com.android.support:multidex:1.0.3'

一切都很好,但更新到27.1.0后

它会在生成apk时导致错误

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

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / arch / lifecycle / LiveData $ 1.class

java android
1个回答
3
投票

这可能是由于依赖项的版本不匹配而发生的。我检查了它的依赖树:

android.arch.lifecycle:extensions:1.0.0

android.arch.lifecycle:livedata-core:1.1.0

看到不匹配的1.0.01.1.0

在您的情况下尝试更新:

implementation 'com.firebaseui:firebase-ui-firestore:3.2.1'

至:

implementation 'com.firebaseui:firebase-ui-firestore:3.2.2'

应该有希望修复版本问题。

请注意,不推荐使用compile,而是使用implementation代替所有依赖项。

更新:

您始终可以通过Windows中的命令gradlew your_app_name:dependencies检查依赖关系树

© www.soinside.com 2019 - 2024. All rights reserved.