wrobins / cordova-plugin-msal

Use the newest Microsoft MSAL library in your Cordova-based project!
Apache License 2.0
23 stars 63 forks source link

When building an Ionic solution, the android build fails stating it has duplicate classes #9

Closed TonDekker closed 4 years ago

TonDekker commented 4 years ago

Hi,

I've tried to integrate your plugin in a small test project, and when creating an android build it fails with the following message:

* What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Program type already present: com.nimbusds.jose.AlgorithmFamily Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.

I tried to skip the line in the build.gradle so it doesn't copy the 'nimbus-jose-jwt' library during build, but I suspect this is required in order for the msal plugin to function?

Any help would be much appreciated.

wrobins commented 4 years ago

Hello!

I bet your issue is that my initial release had a statically compiled .jar version of com.jimbusds.jose.jwt which it was told to build in Gradle. I suggest trying to pull the latest version of this plugin which I released today @2.0.0 and see if it fixes your issue, since it has no binary blob dependencies.

One issue you may encounter, depending on your version of cordova and cordova-android, may be that it complains about other types of conflicting dependencies because of androidx. If you get anything like that, try also installing the androidx adapter plugins per this guide and see if you have any luck there.

cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter

Thanks for your feedback and let me know if this gets it to build for you!

TonDekker commented 4 years ago

Thanks for the update. Android build succeeds (after adding the plugins you mentioned).

Now let's see if Ican get it to work :D

navjotsrmtpl commented 3 years ago

thanx it worked