SVGImage not compatible work with Shared Projects
See original GitHub issueIn fact, Build Action is Embedded Resource is defined 😃
System.Exception: Error retrieving ic_call_black_24px.svg make sure Build Action is Embedded Resource
at SVG.Forms.Plugin.iOS.SvgImageRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1 e) [0x00046] in <filename unknown>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].SetElement (Xamarin.Forms.Platform.iOS.TElement element) [0x00118] in <filename unknown>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement view) [0x0001b] in <filename unknown>:0
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x00006] in <filename unknown>:0
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001f] in <filename unknown>:0
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (1 by maintainers)
Even setting build action to embedded resource you have to write the resource ID “SvgTest.Images.github10.svg” in the properties pad as specified here
Now I’m getting the error “Invalid parameters to context creation” in iOS and “width and height must be > 0” in android.
Ok I’ve been having a go at this for a few days now and I have no clue why I can’t get this to work. I made a completely new Shared project, installed the NuGet package, and just added a SvgImage to the generated main content page and my app is crashing after launch.
I thought it might have been the svg files I made so I grabbed the ones from the SampleApp and it’s still breaking.
I’ve tried putting the .svg inside the Resources/Drawable and making a folder in the main project. I set the .svg to EmbeddedResource. The IDs referring to them is correct.
Has anyone successfully gotten this package to work with Shared Project and would be willing to tell me what I’m doing wrong here?