Plugins conflict when there is no actual conflict
Bug Report
Plugins conflict when there is no actual conflict:
i created two plugins A and B A: has a config-file tag that adds two activity tags to the application tag. B: an edit-config that adds attributes to the application tag.
when i add B and then A no issue when i add A and then B (i need this because i've created a cordova app starter that has the A plugin by default), it says there's a conflict that actually doesn't exist but no problem i tried to force the command the first activity tag added by the A Plugin is being removed which crushes the A plugin
What is expected to happen?
the B plugin should be added with no probs at all;
no need to force at all because there is no actual conflict.
or fix the conflict detection algo.
thank you
Version information
Cordova-android: 10.1.2 cordova-cli: 11.0.0 windows 10
Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Hi, I have the same Problem, but with a Cordova app and a plugin.
I'm using cordova-plugin-googlemaps which add some values to AndroidManifest.xml with config-file:
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="com.google.android.geo.API_KEY" android:value="${GOOGLE_MAPS_ANDROID_API_KEY}"/>
<!-- Google Play Services SDK -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<!-- for Android 9 or above -->
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
</config-file>
(Sources can be found here: https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/2cdc896cb5edfadb02aed9995ea742567dc8de02/plugin.xml#L251)
In my config.xml I want to change something on /manifest/application:
<edit-config file="AndroidManifest.xml"
target="/manifest/application"
mode="merge">
<application android:allowBackup="false"/>
</edit-config>
When I build android, it says in the log:
Conflict found, edit-config changes from config.xml will overwrite plugin.xml changes
But there should not be a conflict.
Finally android:allowBackup="false" was added and the changes from cordova-plugin-googlemaps were partially added. Only the first line was not added:
<meta-data android:name="com.google.android.geo.API_KEY" android:value="${GOOGLE_MAPS_ANDROID_API_KEY}"/>
My app crashed, because there is no API-Key present for Google Maps.
Related Issues: https://github.com/apache/cordova-android/issues/1280 https://github.com/apache/cordova-android/issues/1126