You need to declare GOOGLE_MAPS_ANDROID_API_KEY in config.xml

After updating my google maps getting error in KEY. even my key was defined in my config.xml

FAILURE: Build failed with an exception.

  • Where:
    Script ‘/AppName/platforms/android/cordova-plugin-googlemaps/appName-apikey.gradle’ line: 39

  • What went wrong:
    A problem occurred evaluating script.
    You need to declare GOOGLE_MAPS_ANDROID_API_KEY in config.xml.


Found the solution.

Not Working

<plugin name="cordova-plugin-googlemaps" spec="2.6.0">
        <variable name="API_KEY_FOR_ANDROID" value="***" />
        <variable name="API_KEY_FOR_IOS" value="***" />

Solution (declare key outside from plugin tag and within widget tag)

<preference name="GOOGLE_MAPS_ANDROID_API_KEY" value="***" />
<preference name="GOOGLE_MAPS_IOS_API_KEY" value="****" />

@webumer Yes, you are correct.


The solution specified by @webumer is correct. You have to add preference with name as GOOGLE_MAPS_ANDROID_API_KEY for android and GOOGLE_MAPS_IOS_API_KEY for ios within the widget tag.

You can also find complete implementation of Google Maps using Ionic 4 at -

this worked for me…