I\'m in trouble since yesterday. In my internship I faced the following build error, but I couldn\'t understand why :
$ cordova build android
[...]
FAILURE
I had to do:
cordova plugin rm cordova-plugin-compat --force
cordova plugin add cordova-plugin-compat@1.2
cordova platform rm android
cordova platform add android@6.3.0
considering you can't simply remove cordova-plugin-compat because plugins like cordova-plugin-file depend on it.
I have remove the Compat plugin after the update the dependency of other plugins; like Camera to the new version and it's work. Example: cordova plugin rm cordova-plugin-camera --save cordova plugin add cordova-plugin-camera@latest --save Post the new plugin addition the old version 2.3.0 was replaced with 4.0.2 for Camera plugin.
after this step. I have simply remove the plugin "Compat" cordova plugin rm cordova-plugin-compat --force
On Resume. This mean that plugin-camera is not compatible with the last version of android oreo
Most likely you are using the newly released cordova-android@6.3.0
, 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 cordova-plugin-compat@1.2
which includes an engine constraint to prevent the Java files being re-installed into the cordova-android@6.3+
platform:
cordova plugin add cordova-plugin-compat@1.2
Another update (copypasted from comments)
After removing and adding cordova-plugin-compat@1.2, instead of removing and adding entire Android platform you can only remove files BuildHelper.java and PermissionHelper.java from folder platforms/android
I am using Ionic 4 and this solved it for me (only takes a few seconds to run):
cordova clean