I try to add Google Maps to my Ionic 2 project, but I get a set of errors:
"Error: exec proxy not found for :: GoogleMaps :: getMap" "Error: exec proxy not found for :: GoogleMaps :: exec"
I copied the sample code from https://ionicframework.com/docs/native/google-maps/
import { Component } from '@angular/core';
import {
GoogleMaps,
GoogleMap,
GoogleMapsEvent,
LatLng,
CameraPosition,
MarkerOptions,
Marker
} from '@ionic-native/google-maps';
@Component({
selector: 'page-map',
templateUrl: 'map.html'
})
export class MapPage {
constructor(private googleMaps: GoogleMaps) {}
ionViewDidLoad() {
this.loadMap();
}
loadMap() {
let element: HTMLElement = document.getElementById('map');
let map: GoogleMap = this.googleMaps.create(element);
map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
let ionic: LatLng = new LatLng(43.0741904,-89.3809802);
let position: CameraPosition = {
target: ionic,
zoom: 18,
tilt: 30
};
map.moveCamera(position);
let markerOptions: MarkerOptions = {
position: ionic,
title: 'Ionic'
};
const marker: Marker = map.addMarker(markerOptions)
.then((marker: Marker) => {
marker.showInfoWindow();
});
}
}
Run codeHide result
source
share