1
votes

Just upgraded from React Native .26 to .29 and am getting the below error when trying to run my Android project. I've gone to those files and changed the names, moved the folders, etc. They're rebuild, and duplicated, on each build. Any idea where this could be happening from?

... ... :app:preDexDebug UP-TO-DATE :app:dexDebug UP-TO-DATE :app:validateDebugSigning :app:packageDebug Error: duplicate files during packaging of APK /Users/nhyland/Documents/react-native/BidSmart/android/app/build/outputs/apk/app-debug-unaligned.apk Path in archive: META-INF/LICENSE Origin 1: /Users/nhyland/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.4.1/b130bcfb5a9c410c3cbd2e0adec9437e69a39e2c/jackson-core-2.4.1.jar Origin 2: /Users/nhyland/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.4.1/55605135bd7b836612e0bba7037c9669f6ccf89f/jackson-annotations-2.4.1.jar You can ignore those files in your build.gradle: android {
packagingOptions { exclude 'META-INF/LICENSE' } } :app:packageDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:packageDebug'.

    Duplicate files copied in APK META-INF/LICENSE File 1: /Users/nhyland/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.4.1/b130bcfb5a9c410c3cbd2e0adec9437e69a39e2c/jackson-core-2.4.1.jar File 2: /Users/nhyland/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.4.1/55605135bd7b836612e0bba7037c9669f6ccf89f/jackson-annotations-2.4.1.jar

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.727 secs Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html

1

1 Answers

1
votes

Fixed by adding the below to build.gradle: Broken for other reasons now :-)

packagingOptions {
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/NOTICE'
      }