1
votes

while adding a platform to cordova project ionic platform add android in last I got this error,

Failed to install 'plugin.google.maps':Error: Variable(s) missing: API_KEY_FOR_ANDROID at C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:343:23 at _fulfilled (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54) at self.promiseDispatch.done (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30) at Promise.promise.promiseDispatch (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:749: 13) at C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:557:44 at flush (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17) at nextTickCallbackWith0Args (node.js:420:9) at process._tickCallback (node.js:349:13) Error: Variable(s) missing: API_KEY_FOR_ANDROID

however I have provided recently created key in google console in pakage.json

{
      "variables": {
        "API_KEY_FOR_ANDROID": "My Key Here"
      },
      "locator": "cordova-plugin-googlemaps",
      "id": "plugin.google.maps"
    }, 

also replaced the key in index.html at <script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=My Key Here"></script>

why I am getting this?

1
Just a comment about facing an issue getting the API to work in Cordova. I ended up going with Google's JavaScript API vs. the plugin for Cordova and it worked like a charm. I followed this example and it worked like a charm. developers.google.com/maps/documentation/javascript/examples/… - Patrick

1 Answers

0
votes

Run this command:

cordova plugin add cordova-plugin-admob-free --save --variable ADMOB_APP_ID="<YOUR_ADMOB_APP_ID_AS_FOUND_IN_ADMOB>"