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’. > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Program type already present: android.support.v4.media.MediaBrowserCompat$ConnectionCallback$StubApi21 Learn how to resolve the issue at 添加 build 依赖项  |  Android 开发者  |  Android Developers. 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" />