Reputation: 3621
I have an old project that running on the old VS (2017) and currently trying to run in vs2022 so I trying to upgrade. I got multiple error and related to the OxyPlot. Here are the error.
First error:
Severity Code Description Project File Line Suppression State
Error Invalid value 'armeabi' in $(AndroidSupportedAbis). This ABI is no longer supported. Please update your project properties to remove the old value. If the properties page does not show an 'armeabi' checkbox, un-check and re-check one of the other ABIs and save the changes. OxyPlot.Xamarin.Android
Second error:
Error The $(TargetFrameworkVersion) for OxyPlot.Xamarin.Forms.Platform.Android (v9.0) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (10.0). You need to increase the $(TargetFrameworkVersion) for OxyPlot.Xamarin.Forms.Platform.Android. OxyPlot.Xamarin.Forms.Platform.Android
So the first error about the SupportedAbis
I have handled by changing the .csproj
from
`<AndroidSupportedAbis>armeabi</AndroidSupportedAbis>`
to
<AndroidSupportedAbis>x86_64</AndroidSupportedAbis>
The problem seems fine but after I clean
and rebuild
another error comes as below
Severity Code Description Project File Line Suppression State
Error invalid file path '...\OxyPlot\OxyPlot.Xamarin.Android\obj\Debug\100\res\main.xml'. OxyPlot.Xamarin.Android
For the second error. I have changed the project properties -> application -> compile using Adnroid version: (Target Framework) to Android 10.0
. After clean
and rebuild
the error multiply and going crazy as below:
Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'Android' does not exist in the namespace 'Xamarin.Forms.Platform' (are you missing an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 6 Active
Error CS0246 The type or namespace name 'ExportRendererAttribute' could not be found (are you missing a using directive or an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 9 Active
Error CS0246 The type or namespace name 'ExportRenderer' could not be found (are you missing a using directive or an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 9 Active
Error CS0246 The type or namespace name 'PlotView' could not be found (are you missing a using directive or an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 9 Active
Error CS0234 The type or namespace name 'Android' does not exist in the namespace 'OxyPlot.Xamarin' (are you missing an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 15 Active
Error CS0246 The type or namespace name 'ViewRenderer<,>' could not be found (are you missing a using directive or an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 20 Active
Error CS0234 The type or namespace name 'PlotView' does not exist in the namespace 'OxyPlot.Xamarin.Forms' (are you missing an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 20 Active
Error CS0246 The type or namespace name 'PlotView' could not be found (are you missing a using directive or an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 20 Active
Error CS0246 The type or namespace name 'ElementChangedEventArgs<>' could not be found (are you missing a using directive or an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 51 Active
Error CS0234 The type or namespace name 'PlotView' does not exist in the namespace 'OxyPlot.Xamarin.Forms' (are you missing an assembly reference?) OxyPlot.Xamarin.Forms.Platform.Android ...\OxyPlot\OxyPlot.Xamarin.Forms.Platform.Android\PlotViewRenderer.cs 51 Active
PlotViewRenderer.cs
using Android.Content;
using OxyPlot.Xamarin.Forms;
using OxyPlot.Xamarin.Forms.Platform.Android;
using global::Xamarin.Forms;
using global::Xamarin.Forms.Platform.Android;
// Exports the renderer.
[assembly: ExportRenderer(typeof(PlotView), typeof(PlotViewRenderer))]
namespace OxyPlot.Xamarin.Forms.Platform.Android
{
using System.ComponentModel;
using OxyPlot.Xamarin.Android;
/// <summary>
/// Provides a custom <see cref="OxyPlot.Xamarin.Forms.PlotView" /> renderer for Xamarin.Android.
/// </summary>
public class PlotViewRenderer : ViewRenderer<Xamarin.Forms.PlotView, PlotView>
{
/// <summary>
/// Initializes static members of the <see cref="PlotViewRenderer"/> class.
/// </summary>
static PlotViewRenderer()
{
Init();
}
/// <summary>
/// Initializes a new instance of the <see cref="PlotViewRenderer"/> class.
/// </summary>
public PlotViewRenderer(Context context) : base(context)
{
// Do not delete
}
/// <summary>
/// Initializes the renderer.
/// </summary>
/// <remarks>This method must be called before a <see cref="T:PlotView" /> is used.</remarks>
public static void Init()
{
OxyPlot.Xamarin.Forms.PlotView.IsRendererInitialized = true;
}
/// <summary>
/// Raises the element changed event.
/// </summary>
/// <param name="e">The event arguments.</param>
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.PlotView> e)
{
base.OnElementChanged(e);
if (e.OldElement != null || this.Element == null)
{
return;
}
var plotView = new PlotView(this.Context)
{
Model = this.Element.Model,
Controller = this.Element.Controller
};
plotView.SetBackgroundColor(this.Element.BackgroundColor.ToAndroid());
this.SetNativeControl(plotView);
}
/// <summary>
/// Raises the element property changed event.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The event arguments.</param>
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
if (this.Element == null || this.Control == null)
{
return;
}
if (e.PropertyName == Xamarin.Forms.PlotView.ModelProperty.PropertyName)
{
this.Control.Model = this.Element.Model;
}
if (e.PropertyName == Xamarin.Forms.PlotView.ControllerProperty.PropertyName)
{
this.Control.Controller = this.Element.Controller;
}
if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
{
this.Control.SetBackgroundColor(this.Element.BackgroundColor.ToAndroid());
}
}
}
}
Also, I have tried to clean project
and then delete bin and obj folder, close the VS and reopened and rebuild. It is still remains error.
Any idea? Thank in advance.
Upvotes: 0
Views: 318
Reputation: 14509
I have checked the nuget package( OxyPlot.Xamarin.Forms ) you mentioned. It's too old and not compatible with the .net maui project.
So you need to remove the reference of it when you update your project from xamarin forms to .net maui.
Or you can refer to the this document about Using Custom Renderers in .NET MAUI to migrate the PlotView and the PlotViewRenderer manually.
Upvotes: 0