i need your help please, i'm building android application
i use Cordova google maps plugins with ionic v 1.3
all work fine
if i add two marker one with icon and other without or with the same icone is work good
the problem is when i add two markers with different icons
application crash without any error
this is my code :
//create marker of begin and arrive
map.clear();
map.addMarker({
position: depart,
title: "Vous êtes ici.",
//snippet: "description",
icon: {
url: "www/images/depart.png"
},
animation: plugin.google.maps.Animation.BOUNCE
});
map.addMarker({
position: arriver,
title: "L'arrivée.",
//snippet: "description",
icon: {
url: "www/images/arrive.png"
},
animation: plugin.google.maps.Animation.BOUNCE
});
thanks
My logcat errors log :
E/AndroidRuntime(11620): FATAL EXCEPTION: AsyncTask #2
E/AndroidRuntime(11620): Process: com.ionicframework.myApp468132, PID: 11620
E/AndroidRuntime(11620): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(11620): at android.os.AsyncTask$3.done(AsyncTask.java:300)
E/AndroidRuntime(11620): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime(11620): at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime(11620): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime(11620): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/AndroidRuntime(11620): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(11620): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(11620): at java.lang.Thread.run(Thread.java:841)
E/AndroidRuntime(11620): Caused by: java.lang.IllegalStateException: Not on the main thread
E/AndroidRuntime(11620): at maps.w.d.a(Unknown Source)
E/AndroidRuntime(11620): at maps.y.F.a(Unknown Source)
E/AndroidRuntime(11620): at maps.ad.S.b(Unknown Source)
E/AndroidRuntime(11620): at aep.onTransact(:com.google.android.gms.DynamiteModulesB:169)
E/AndroidRuntime(11620): at android.os.Binder.transact(Binder.java:361)
E/AndroidRuntime(11620): at com.google.android.gms.maps.model.internal.zzf$zza$zza.setVisible(Unknown Source)
E/AndroidRuntime(11620): at com.google.android.gms.maps.model.Marker.setVisible(Unknown Source)
E/AndroidRuntime(11620): at plugin.google.maps.PluginMarker$1.onPostExecute(PluginMarker.java:164)
E/AndroidRuntime(11620): at plugin.google.maps.PluginMarker$7.doInBackground(PluginMarker.java:743)
E/AndroidRuntime(11620): at plugin.google.maps.PluginMarker$7.doInBackground(PluginMarker.java:698)
E/AndroidRuntime(11620): at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/AndroidRuntime(11620): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime(11620): ... 4 more
I was using this plugin with ionic 2 and getting same issue, but after digging plugin's java code i tried as following :
Then i used during adding location marker as following :
icon : './assets/icon/myicon1.png'
icon : './assets/icon/myicon2.png'
Now its working fine.