Xamarin中的.Jar文件绑定错误

时间:2017-04-12 05:19:14

标签: c# xamarin xamarin.android

我正在尝试在我的Binding Library Project中绑定DJI-SDK.Jar文件。当我构建我的项目时,它向我展示了这些错误

构建项目时的Param错误

CS1519 Invalid token 'params' in class, struct, or interface member declaration JarBinding

我删除了Param关键字时显示的其他错误

Error CS0535 'ResolutionAndFrameRate' does not implement interface member 'IComparable.CompareTo(Object)'

Error CS0535 'FlyforbidUtils.DataComparator' does not implement interface member 'IComparator.Compare(Object, Object)'

Error CS0111 Type 'ServiceManager' already defines a member called 'Destroy' with the same parameter types

Error CS0111 Type 'UsbHostServiceRC' already defines a member called 'Destroy' with the same parameter types

Error CS0111 Type 'BluetoothLeService' already defines a member called 'Destroy' with the same parameter type

Error CS0121 The call is ambiguous between the following methods or properties: 'BluetoothLeService.Destroy()' and 'BluetoothLeService.Destroy()'

请帮我解决这些问题。 提前谢谢。

1 个答案:

答案 0 :(得分:1)

IComparable的Java泛型实现存在问题。

您可以创建一个包含部分your_class类和CompareTo显式方法实现的Additions / your_class_name.cs,如:

using System;
using System.Collections.Generic;
using Android.Runtime;

namespace Com.Journeyapps.Barcodescanner
{
    public partial class Size
    {
        int Java.Lang.IComparable.CompareTo(Java.Lang.Object obj)
        {
            return CompareTo((Com.Journeyapps.Barcodescanner.Size)obj);
        }
    }
}

请在此处查看此答案:https://forums.xamarin.com/discussion/1950/binding-jar-file-with-class-that-implements-java-lang-icomparable