Runtime error "unable to load SVG from assets" for location marker

866 views
Skip to first unread message

Phil_H

unread,
Feb 21, 2018, 7:57:07 AM2/21/18
to MIT App Inventor Forum
I'm displaying a map with my location from the location sensor and a location marker placed by CreateMarker method. This works perfectly when testing with AI companion but when I use the app deployed via an apk file I get the message "unable to load SVG from assets". Clicking the background map shows just the phone location but not the marker. If I Disable the CreateMarker block then there are no errors so the problem is definitely associated with that method.

I've googled but cannot find any relevant information.

Has anyone any idea where I might find a solution?

SteveJG

unread,
Feb 21, 2018, 8:53:05 AM2/21/18
to MIT App Inventor Forum
I expect this issue with svg images and the Map component is discussed here  Phil https://groups.google.com/forum/#!searchin/mitappinventortest/svg%7Csort:date/mitappinventortest/nkojwW7iIPY/OTU5HVGnAAAJ 

Not all svg files are created equal.  The problem is not the CreateMarker method.  Some svg images do not work correctly, others do. Try using one of the svg files shown and place it in your Media, then compile again.  Does that work?

Regards,
Steve

Evan Patton

unread,
Feb 21, 2018, 9:45:53 AM2/21/18
to MIT App Inventor Forum
Hi Phil,

Are you only using the CreateMarker block to add markers? If so, try adding a Marker to your map and settings its Visible property to false.

Regards,
Evan

Phil_H

unread,
Feb 21, 2018, 9:59:15 AM2/21/18
to MIT App Inventor Forum
Thanks Evan that's a better way of doing it and works fine.

Phil_H

unread,
Feb 21, 2018, 10:01:19 AM2/21/18
to MIT App Inventor Forum
Thanks for the suggestion Steve, The later suggestion of adding an invisible marker to the map in designer worked well for me

Evan Patton

unread,
Feb 21, 2018, 10:14:32 AM2/21/18
to MIT App Inventor Forum
Hi Phil,

The issue arrises due to the fact that App Inventor conditionally includes resources based on the components used. Marker declares that it uses the marker.svg file, and the Map component does not. Therefore, when you build an application using Map but it doesn't contain a Marker at build time, the build system won't include the SVG. We will fix this in a future release.

Cheers,
Evan

Ronald Besdansky

unread,
Feb 23, 2018, 8:45:58 PM2/23/18
to MIT App Inventor Forum
I think a work-around for this issue is just to add a dummy marker to the map in the Designer. Its Visible property can be set to False in the Designer.
Reply all
Reply to author
Forward
0 new messages