Android Build Error

When build an android apk, it shows an error

FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’. > Error while merging dex archives: Program type already present:$ConnectionCallback$StubApi21 Learn how to resolve the issue at Build ID: 398907c8-e301-4212-9899-0b2ced094240

I looks like a conflict between plugins in your project - maybe more than one is trying to add the same resource?

Try removing plugins from your project to find which one is the cause. The author of the plugin maybe able to help from there.

When I used the below plugin, that error was raised

<plugin name="cordova.plugins.diagnostic" source="npm" />