Getting error in using ionic native google map

Native Google map plugin is working great. Thank you for making such awesome plugin. :slight_smile:
But it is showing this error.

polyfills.js:3 Unhandled Promise rejection: Cannot read property '_privateInitialize' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property '_privateInitialize' of undefined
    at Map.<anonymous> (file:///android_asset/www/plugins/cordova-plugin-googlemaps/www/Map.js:1202:13)
    at file:///android_asset/www/plugins/cordova-plugin-googlemaps/www/commandQueueExecutor.js:63:21
    at t.invoke (file:///android_asset/www/build/polyfills.js:3:14976)
    at r.run (file:///android_asset/www/build/polyfills.js:3:10143)
    at file:///android_asset/www/build/polyfills.js:3:20242
    at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:15660)
    at r.runTask (file:///android_asset/www/build/polyfills.js:3:10834)
    at o (file:///android_asset/www/build/polyfills.js:3:7894) TypeError: Cannot read property '_privateInitialize' of undefined
    at Map.<anonymous> (file:///android_asset/www/plugins/cordova-plugin-googlemaps/www/Map.js:1202:13)
    at file:///android_asset/www/plugins/cordova-plugin-googlemaps/www/commandQueueExecutor.js:63:21
    at t.invoke (file:///android_asset/www/build/polyfills.js:3:14976)
    at r.run (file:///android_asset/www/build/polyfills.js:3:10143)
    at file:///android_asset/www/build/polyfills.js:3:20242
    at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:15660)
    at r.runTask (file:///android_asset/www/build/polyfills.js:3:10834)
    at o (file:///android_asset/www/build/polyfills.js:3:7894)

Please help.
Thank you.

1 Like

I am also having the same issue. Did you find any solution for it?

Could you make an example project, which is able to reproduce this issue 100%, put the project files on Github, then let me know please.

Have you solved this problem? I’m having the same issue

Creo que ya encontré una solución, parece que hay que esperar que el mapa este listo para adicionar un marcador o hacer alguna acción y esto es posible con:

this.myMap.one(GoogleMapsEvent.MAP_READY).then(() => {
    // Now you can use all methods safely.
    let marker: Marker = this.map.addMarkerSync({
        position: { lat: location.lat, lng: location.lng },
        title: "La ubicación de tu mascota",
        //'animation': GoogleMapsAnimation.BOUNCE,
        draggable: true,
        icon: "red"
    });

    this.map.animateCamera({
        target: marker.getPosition(),
        zoom: 17
    });

    marker.showInfoWindow();
})
.catch(error => {
    console.log(error);
});