未生成 Java 绑定抽象类 [英] Java Binding Abstract class not being generated

查看:25
本文介绍了未生成 Java 绑定抽象类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误 CS0234:命名空间中不存在类型或命名空间名称 IBitmap'Com.Sushi.Hangover'.您是否缺少程序集参考?

Error CS0234: The type or namespace name IBitmap' does not exist in the namespaceCom.Sushi.Hangover'. Are you missing an assembly reference?

我有一个 Android 绑定项目,其中包含从多个接口继承的类,但这些接口并未生成,因此所有依赖于它们的公共类都无法绑定.

I have an Android binding project which has classes that are inheriting from multiple interfaces but these interfaces are not been generated and thus all of the public classes that depend upon them are failing to bind.

abstract interface Bitmap
{
   ~~~ (methods removed)
}

api.xml:

<interface abstract="true" deprecated="not deprecated" final="false" name="Bitmap" static="false" visibility="">

如您所见,此接口的 visibility 未设置为 public,因此不会生成 C# 代码,但是开始生成依赖于此的公共类界面:

As you can see the visibility of this interface is not set to public and thus no C# code is generated, but there are public classes begin generated that depend on this interface:

public partial class DrawableDesign : global::Com.Sushi.Hangover.IBitmap {

绑定知道接口,因为它将接口名称从 Bitmap 转换为 IBitmap.

The binding is aware of the interface as it transforming the interface name from Bitmap to IBitmap.

有什么方法可以强制创建这些接口,而无需返回 Java 代码并将这些接口更改为 public 以将它们作为 visibility="public" 放入 api.xml?

Is there any way to force these interfaces to be created without going back the Java code and changing these interfaces to public to get them into the api.xml as visibility="public"?

注意:我使用的是稳定频道(Xamarin.Android 版本:6.0.3.5),因为此客户端没有 Alpha/Beta 访问权限

Note: I am on stable channel (Xamarin.Android Version: 6.0.3.5) as this client does not have Alpha/Beta access

推荐答案

我写了一个关于这个主题的小指南,可能在某些领域有所帮助:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb

I've written a smallish guide on this topic that might help in certain areas: https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb

简而言之,您可以尝试像@Cheesebaron 已经提到的那样更改可见性:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#class-visibility(将/class替换为interface或读取常用路径)

In short, you could potentially try changing the visibility like @Cheesebaron has mentioned already: https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#class-visibility (Replace /class with interface or read the common paths)

否则,您可以尝试从头开始添加节点:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#adding-types

Otherwise you can potentially try to add the node from scratch: https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#adding-types

要获得更准确的答案,我相信我们需要查看相应的 .jar/.aar 和当前的 Bindings 项目.

For a more exact answer, I believe we would need to see the respective .jar/.aar and the current Bindings project.

这篇关于未生成 Java 绑定抽象类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆