Android Xamarin 中的 .aar 绑定库

Android .aar binding library in Xamarin

我有一个要在 Xamarin 中使用的 .aar 库。大多数组件都可以正常工作,但是一个接口完全缺失 在调试中构建的绑定库中,我发现了以下内容

1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewFragment._1.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewFragment._2.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewFragment._3.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewFragment.ICameraCallback.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewFragment.CameraOrientationDetector.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewRfFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewRfFragment._1.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewRfFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewRfFragment._2.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewRfFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewRfFragment._3.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewRfFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewRfFragment.ICameraCallback.
1>BINDINGSGENERATOR : warning BG8604: top ancestor FaceViewRfFragment not found for nested type Com.Truesen.Face.Entrance.Fragment.FaceViewRfFragment.CameraOrientationDetector.

ICameraCallback 是我需要的接口,如何才能让接口正确生成?或者我如何手动添加它

这是我正在使用的 .aar 文件的 link https://drive.google.com/file/d/1ibfvjws26PesBxjojB_UNyWYiFf0yKqK/view?usp=sharing

内部库依赖于 androidx.fragmentandroidx.annotation,确保您也将其添加为对绑定项目的引用(包在 nuget 上)。它们可能会丢失,因此无法创建正确的绑定。 使用 android 绑定确保 java project/library 中的所有依赖项也添加到 xamarin 绑定项目和最终项目中很重要。这应该让编译器找到所有正确的引用并正确地进行绑定。

查看绑定是否正确完成的一个好方法是检查您的最终项目,在 Visual Studio 中打开对绑定 (.dll) 的引用,然后查看 类 和方法是什么在那里可用。这应该类似于您的 .aar 项目中的 类 和方法。

如果不是这种情况,首先检查绑定是否缺少引用,下一个选项是使用 add-node 标签将缺少的 classes/methods 等手动添加到绑定中。