1

构建我的 APK 时出现以下错误。

Duplicate files copied in APK META-INF/android.arch.lifecycle_runtime.version
    File1: /Users/.../build/intermediates/exploded-aar/com.google.android.gms/play-services-base/12.0.0/jars/classes.jar
    File2: /Users/.../build/intermediates/exploded-aar/android.arch.lifecycle/runtime/1.1.1/jars/classes.jar

app build.gradle中添加的依赖如下

compile "android.arch.lifecycle:runtime:1.1.1"
compile "android.arch.lifecycle:extensions:1.1.1"

compile "com.google.android.gms:play-services-base:12.0.0"
compile "com.google.android.gms:play-services-identity:12.0.0"
compile "com.google.android.gms:play-services-auth:12.0.0"
compile "com.google.android.gms:play-services-auth-api-phone:12.0.0"
4

1 回答 1

0

在 APK META-INF/android.arch.lifecycle_runtime.version 中复制的重复文件

文件1:/Users/.../build/intermediates/exploded-aar/com.google.android.gms/play-services-base/12.0.0/jars/classes.jar

文件2:/Users/.../build/intermediates/exploded-aar/android.arch.lifecycle/runtime/1.1.1/jars/classes.jar

它说它找到了两个具有相同库的文件,一个在您的第一次编译中:

compile "android.arch.lifecycle:runtime:1.1.1"

然后另一个在

compile "com.google.android.gms:play-services-base:12.0.0"

那是因为com.google.android.gms:play-services-base:12.0.0已经包含lifecycle:runtime只删除第一行,然后再次重建/清理项目。

如果它不起作用,只需将其排除在您gradle.build本问题中

exclude 'META-INF/android.arch.lifecycle_runtime.version'
exclude 'META-INF/com.android.support_support-v4.version'
exclude 'META-INF/com.android.support_support-fragment.version'
exclude 'META-INF/com.android.support_support-media-compat.version'
exclude 'META-INF/com.android.support_support-core-utils.version'
exclude 'META-INF/com.android.support_support-compat.version'
exclude 'META-INF/com.android.support_support-core-ui.version'

另外你也可以看看这个问题:类似的问题

于 2019-03-29T13:23:26.600 回答