javiersantos / PiracyChecker

An Android library that prevents your app from being pirated / cracked using Google Play Licensing (LVL), APK signature protection and more. API 14+ required.
Apache License 2.0
1.55k stars 174 forks source link

Library conflicts with other libraries when using Kotlin #68

Closed bjarn closed 5 years ago

bjarn commented 5 years ago
Details
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

jahirfiquitiva commented 5 years ago

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 5 years ago

Thanks a lot! Seems to have fixed the issue.

jahirfiquitiva commented 5 years ago

Good to know!