star-micronics / StarXpand-SDK-Android

StarXpand SDK for Android is a software development kit for supporting application development for Star Micronics devices.
https://star-m.jp/starxpandsdk-oml.html
Other
14 stars 2 forks source link

Getting checkDebugDuplicateClasses error when building application with another third-party dependency #1

Closed mohammedhammoud closed 2 years ago

mohammedhammoud commented 2 years ago

I'm getting the following error when trying to build stario10 and with another third-party dependency.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class a.a.a.a found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.a$a found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.b found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.c found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.d found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.e found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.f found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.k.a found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.l.a found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.l.b found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.m.a found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.m.a$a found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.m.b found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.m.c found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)
     Duplicate class a.a.a.m.d found in modules jetified-pos-comm-sdk-1.2.2-runtime (net.geidea.sdk:pos-comm-sdk:1.2.2) and jetified-stario10-1.0.0-runtime (com.starmicronics:stario10:1.0.0)

     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

Any ideas on how to solve this?

I have a minimum android project with the current failure setup: https://github.com/mohammedhammoud/geidea-stario10-duplicate-class-deps-error

mohammedhammoud commented 2 years ago

Is it possibile to use -keeppackagenames when compiling com.starmicronics:stario10 for distribution @bandit-ibayashi? (Sorry in advance for pinging you 😄 ).

A similar issue was also fixed with flattenpackagehierarchy here https://github.com/helpcrunch/android-sdk-demo/issues/33

bandit-ibayashi commented 2 years ago

We much appreciate for your report and suggestion.

For the tentative solution, would the following workaround help you? https://stackoverflow.com/questions/59991168/duplicate-class-names-in-two-external-third-party-obfuscated-libraries

mohammedhammoud commented 2 years ago

That solution did not work. I contacted geidea and they solved it at their end by adding flattenpackagehierarchy. I suggest you do the same.

bandit-ibayashi commented 2 years ago

@mohammedhammoud Thank you for trying the solution and I'm afraid that is not work for you. We will respond to this in our next update. Thank you for your patience!

bandit-ibayashi commented 2 years ago

@mohammedhammoud We have updated our library to avoid obfuscation to unnecessary parts as version 1.0.1. We would appreciate your confirmation that this update will resolve this issue.

Thank you for your patience!