Multiple dex files define Lorg/apache/cordova/BuildHelper

Most likely you are using the newly released [email protected], which now includes BuildHelper.java (as noted in your error message) and PermissionHelper.java, but you still have the deprecated cordova-plugin-compat in your project which is causing the build to fail because it also contains these classes.

To fix this, remove cordova-plugin-compat from your project to uninstall these Java files from the cordova-android platform project::

cordova plugin rm cordova-plugin-compat --force

Update

To persist this change add [email protected] which includes an engine constraint to prevent the Java files being re-installed into the [email protected]+ platform:

cordova plugin add [email protected]

Another update (copypasted from comments)

After removing and adding [email protected], instead of removing and adding entire Android platform you can only remove files BuildHelper.java and PermissionHelper.java from folder platforms/android

Leave a Comment