Generate apk with cordova cli

I try to generate an apk with cordova and I get this error with this command:
cordova build android --release

  • What went wrong:
    Execution failed for task ‘:app:transformDexArchiveWithDexMergerForRelease’.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: org.apache.cordova.BuildHelper

How can I solve it? or what am I doing wrong?

You should ask this question at a cordova forum.

I solved this by removing the cordova-plugin-compat plugin as cordova for android already includes the functionality and the org.apache.cordova.BuildHelper was getting included twice.

1 Like