I have a cordova application that needs several plugins and you want to configure it using the config.xml file. For example, I need "plugin.google.maps", which requires the following variable during installation: API_KEY_FOR_ANDROID
If I do the following without specifying a plugin in config.xml , this works :
cordova platform add android cordova plugin add plugin.google.maps --variable API_KEY_FOR_ANDROID="$MYKEY"
It does not work if I insert my config.xml file:
<feature name="cordova-plugin-app-version"> <param name="id" value="plugin.google.maps" /> <param name="API_KEY_FOR_ANDROID" value="$MYKEY" /> </feature>
and then run
cordova platform add android
I get the following error:
Installing "plugin.google.maps" for android Failed to install 'plugin.google.maps':Error: Variable(s) missing: API_KEY_FOR_ANDROID at /usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:299:23 at _fulfilled (/usr/lib/node_modules/cordova/node_modules/q/q.js:787:54) at self.promiseDispatch.done (/usr/lib/node_modules/cordova/node_modules/q/q.js:816:30) at Promise.promise.promiseDispatch (/usr/lib/node_modules/cordova/node_modules/q/q.js:749:13) at /usr/lib/node_modules/cordova/node_modules/q/q.js:557:44 at flush (/usr/lib/node_modules/cordova/node_modules/q/q.js:108:17) at process._tickCallback (node.js:415:13)
I find it difficult to find clear documentation on the plugin configuration in the config.xml file. Is this the right way to do this? What am I missing?
source share