1

I have the following error while building my 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

The dependencies added in app build.gradle are as follows

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"
B.B.
  • 924
  • 2
  • 11
  • 28

1 Answers1

0

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

It says that it found two files with the same library, one in your first compile :

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

And then another one in

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

That's because com.google.android.gms:play-services-base:12.0.0 already contains lifecycle:runtime just remove the first line and then rebuild/clean the project again.

If it did not work just exclude this in your gradle.build as pointed in this issue

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'

Plus you can take a look on this problem too : Similar problem

Community
  • 1
  • 1
Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148