Opinel Opinel - 1 year ago 388
Android Question

OxyPlot.Xamarin.Forms package breaks Resource.Designer.cs?

I'm trying to use the OxyPlot.Xamarin.Forms package in my shared Xamarin.Forms project. I added the OxyPlot packages with the NuGet package manager in both the portable and the platform specific (Android) projects like descriped at:


Then I initialized the OxyPlot renderers in the Android project. Now, when I try to start the App the Resource.Designer.cs file is generated, but I get hundreds of errors like so:

Error CS0117 'Resource.Attribute' does not contain a definition for 'mediaRouteSettingsDrawable' OxyPlotShared.Droid \OxyPlotShared\OxyPlotShared.Droid\Resources\Resource.Designer.cs

I use Xamarin.Forms v2.2.0.31 and all OxyPlot packages in version 1.0.0-unstable1983.

Am I missing something?

Answer Source

Note that there are 2 different project templates: Portable and Shared. In your post you mention both of them, so be clear about which one you're using. The specific example you're following is for a Portable project template. After adding the OxyPlot Nuget Package, I had to manually add OxyPlot and OxyPlot.Xamarin.Forms to the References of the Portable one. After that, it worked just fine. I'm using Xamarin.Forms and OxyPlot 1.0.0-unstable1983.

I added the PlotView using code:


 public App()
        PlotModel plotModel = new PlotModel { PlotAreaBackground = OxyColors.LightYellow };
        plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)"));

        // The root page of your application
        MainPage = new ContentPage {
            Content = new PlotView {
                VerticalOptions = LayoutOptions.Fill,
                HorizontalOptions = LayoutOptions.Fill,
                Model = plotModel

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download