javiersantos/PiracyChecker

Library conflicts with other libraries when using Kotlin

bjarn opened this issue · 3 comments

bjarn commented
  • I have verified there are no duplicate active or recent bugs, questions, or requests.
  • I have verified that I am using the latest version of PiracyChecker.
  • I have given my issue a non-generic title.
  • I have read over the documentation (before asking questions on how to do something).
Details
  • PiracyChecker version: 1.2.5
  • Device OS version: n/a
  • Device Manufacturer: n/a
  • Device Name: n/a
Builder
            piracyChecker {
                enableGooglePlayLicensing(APP_PUBLIC_KEY.reversed())
                display(Display.ACTIVITY)
            }.start()
Reproduction Steps
  1. Implement the library and another library with a module named 'library'.
  2. Build the app in Android Studio
  3. Wait until the error pops up
Expected Result

The build should succeed.

Actual Result

The error message that is being thrown by Gradle is:
More than one file was found with OS independent path 'META-INF/library_release.kotlin_module'

A fix for this will be renaming the project. See: https://readyset.build/build-failures-kotlin-metadata-errors-f0090cdf948c

Add this to your app/build.gradle file:

android {
  ...
  packagingOptions {
    pickFirst 'META-INF/core_debug.kotlin_module'
    pickFirst 'META-INF/core_release.kotlin_module'
    pickFirst 'META-INF/library_debug.kotlin_module'
    pickFirst 'META-INF/library_release.kotlin_module'
  }
  ...
}
bjarn commented

Thanks a lot! Seems to have fixed the issue.

Good to know!