dpa99c / cordova-custom-config

Cordova/Phonegap plugin to update platform configuration files based on preferences and config-file data defined in config.xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for cordova-android@7

dpa99c opened this issue · comments

cordova-android@7.0.0 has been released and it makes backwardly-incompatible changes to the structure of the native Android project generated by Cordova.

Therefore current versions of this plugin (v4) are incompatible with cordova-android@7, so a new major version of this plugin will probably need to be released in order to support it.

However, if possible this plugin should maintain backward compatibility for cordova-android@6 and below.

It seems cordova-android@7 also attempts to parse <config-file> blocks in the config.xml, so now <config-file> blocks that are intended for this plugin to parse are being picked up by Cordova and causing errors.

For a reproducible example, run the following:

cordova create test && cd test

cordova platform add android@7.0.0

cordova build android

sed -i '' 's/<platform name="android">/<platform name="android"><config-file parent=".\/application\/activity\/[@android:name=\x27MainActivity\x27]" target="AndroidManifest.xml"><meta-data android:name="foo" android:value="@string\/bar" \/><\/config-file>/' config.xml

cordova build android

The result will be an error:

Error: Unable to graft xml at selector "./application/activity/[@android:name='MainActivity']" 
from "cordova-android@7-test/platforms/android/app/src/main/res/xml/config.xml" during config install

So the next major version of this plugin (cordova-custom-config@5) is going to need to prefix element names in order that Cordova doesn't attempt to parse them:

<config-file> => <custom-config-file>
<preference> => <custom-preference>
<resource> => <custom-resource>