When I add a polyline to my map, it gives the below error.
private routeOptions: PolylineOptions = {
'points': [],
'geodesic': false,
'color': '#488aff',
'width': 10,
};
console.log("this console log is shown");
this.map.addPolyline(routeOptions).then((polyline) => {
console.log("this console log isn't shown as the addPolyline gives an exception");
});
It gives this error:
Exception java.lang.IllegalStateException: no included points
com.google.android.gms.common.internal.zzbo.zza ()
com.google.android.gms.maps.model.LatLngBounds$Builder.build ()
plugin.google.maps.PluginPolyline$1.run (PluginPolyline.java:79)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:7325)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
I suspect the problem has to do with the 'points' key in the routeOptions Object.
Any helps is appreciated.
Additional information: I'm using Ionic 3.5, using the cordova-plugin-googlemaps plugin (native ionic)
Check Polyline API,
The map.addPolyline() method takes a single polyline options object literal, specifying the initial properties of the polyline.
points Array.LatLng The array of LatLng position.
Currently you are passing an empty array of points which means no path is passed.
The exception is also specifying the same.
You need to add an array of LatLng values here -> points:[]
in routeOptions