Android Build mergeDexRelease error

Been trying to make a prod APK from local android-studio and Appflow builds with NO success.
Debug build is done without any problem or warning but prod build is a NO-NO

I get the error:

Task :app:mergeDexRelease FAILED /XXXXX/android/capacitor-cordova-android-plugins/build/.transforms/0930188cce72c864bd49e96356aafb7a/classes/classes.dex, /XXXXX/android/app/build/intermediates/external_libs_dex/release/out/classes.dex","sources":[{"file":"/XXXXX/android/capacitor-cordova-android-plugins/build/.transforms/0930188cce72c864bd49e96356aafb7a/classes/classes.dex"}],"tool":"D8"}

* What went wrong: Execution failed for task ':app:mergeDexRelease'.

I followed all steps to create the necessary certificates to sign the apk, it does not feel like the issue is with the certificates.

For context I have a couple of plugins:

  • "cordova-androidx-build": "^1.0.4",
  • "cordova-plugin-androidx-adapter": "^1.1.3",
  • "cordova-plugin-geolocation": "^4.1.0",
  • "cordova-plugin-ionic": "5.4.7",
  • "cordova-plugin-whitelist": "^1.3.4",
  • "@mauron85/cordova-plugin-background-geolocation": "^3.1.0"

Only by removing cordova-plugin-background-geolocation I am able to go through the build, tried some combinations to see if it was clashing with another plugin but so far no luck.
I am sure I am no the first to use this plugin in a project; all help is welcome :slight_smile:

Had to start from scratch and try again.
Now for no apparent reason it is working