Summary:
When i load kml file via raw resource in which "hotspot" tag is an empty app crash
Steps to reproduce:
simply load 20 MB kml file via following code:
var layer = KmlLayer(mMap, R.raw.campus, context)
Expected behavior:
object of layer should return
load kml to map
Observed behavior:
crash
Device and Android version:
Android 9
Redmi Note 7 PRO
Crash Exception :
~
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.trim()' on a null object reference
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1838)
at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
at java.lang.Float.parseFloat(Float.java:451)
at com.google.maps.android.data.kml.KmlStyleParser.setIconHotSpot(KmlStyleParser.java:176)
at com.google.maps.android.data.kml.KmlStyleParser.createIconStyle(KmlStyleParser.java:95)
at com.google.maps.android.data.kml.KmlStyleParser.createStyle(KmlStyleParser.java:53)
at com.google.maps.android.data.kml.KmlContainerParser.setContainerStyle(KmlContainerParser.java:148)
at com.google.maps.android.data.kml.KmlContainerParser.assignPropertiesToContainer(KmlContainerParser.java:91)
at com.google.maps.android.data.kml.KmlContainerParser.createContainer(KmlContainerParser.java:52)
at com.google.maps.android.data.kml.KmlParser.parseKml(KmlParser.java:74)
at com.google.maps.android.data.kml.KmlLayer.
at com.google.maps.android.data.kml.KmlLayer.
~
@mayank250004 can you provide the KML file you used?
@mayank250004 can you provide the KML file you used?
@barbeau you can download kml file using the following link via google drive
https://drive.google.com/file/d/1O45AKcvzPoPc_SgvmmbqBd-DdbHxIcHH/view?usp=sharing
@barbeau did you check kml file?
any update!
Not at this point, but I hope to have more time to dedicate to this project in the near future.
@barbeau please look if you can
I am stuck in my project because of this issue
Based on the stacktrace and looking at the KML file, I'm guessing this empty tag is causing the issue:
<hotSpot />
As a workaround can you please try deleting this from the KML file and see if it loads then?
@barbeau thanks a lot
after deleting
I am wondering why google not handling this in their code