Java 绑定摘要 class 未生成
Java Binding Abstract class not being generated
Error CS0234: The type or namespace name IBitmap' does not exist in the namespace
Com.Sushi.Hangover'. Are you missing an assembly reference?
我有一个 Android 绑定项目,其中 类 从多个接口继承,但这些接口没有生成,因此所有 public 类依赖于它们的无法绑定。
Java Class:
abstract interface Bitmap
{
~~~ (methods removed)
}
api.xml:
<interface abstract="true" deprecated="not deprecated" final="false" name="Bitmap" static="false" visibility="">
可以看到这个接口的visibility
没有设置成public
所以没有生成C#代码,但是有public类开始生成依赖于此接口:
public partial class DrawableDesign : global::Com.Sushi.Hangover.IBitmap {
绑定知道接口,因为它将接口名称从 Bitmap
转换为 IBitmap
。
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 访问权限
在 Transforms/Metadata.xml 文件内的绑定库中,您可以通过添加以下行来更改可见性:
<attr path="/api/package[@name='com.sushi.hangover']/interface[@name='IBitmap']" name="visibility">public</attr>
鉴于Java世界中的包名称是com.sushi.hangover
,接口名称是IBitmap
。
您可以阅读更多关于 format of attr in the GAPI mono documentation. There is also some nice bindings documentation in the Xamarin Docs 的内容。
我写了一个关于这个主题的小指南,可能对某些领域有帮助:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb
简而言之,您可以尝试像@Cheesebaron 已经提到的那样更改可见性:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#class-visibility(将 /class 替换为界面或读取公共路径)
否则您可以尝试从头开始添加节点:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#adding-types
要获得更准确的答案,我相信我们需要查看相应的 .jar/.aar 和当前的 Bindings 项目。
Error CS0234: The type or namespace name
IBitmap' does not exist in the namespace
Com.Sushi.Hangover'. Are you missing an assembly reference?
我有一个 Android 绑定项目,其中 类 从多个接口继承,但这些接口没有生成,因此所有 public 类依赖于它们的无法绑定。
Java Class:
abstract interface Bitmap
{
~~~ (methods removed)
}
api.xml:
<interface abstract="true" deprecated="not deprecated" final="false" name="Bitmap" static="false" visibility="">
可以看到这个接口的visibility
没有设置成public
所以没有生成C#代码,但是有public类开始生成依赖于此接口:
public partial class DrawableDesign : global::Com.Sushi.Hangover.IBitmap {
绑定知道接口,因为它将接口名称从 Bitmap
转换为 IBitmap
。
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
asvisibility="public"
?
注意:我使用的是稳定频道(Xamarin.Android 版本:6.0.3.5),因为此客户端没有 Alpha/Beta 访问权限
在 Transforms/Metadata.xml 文件内的绑定库中,您可以通过添加以下行来更改可见性:
<attr path="/api/package[@name='com.sushi.hangover']/interface[@name='IBitmap']" name="visibility">public</attr>
鉴于Java世界中的包名称是com.sushi.hangover
,接口名称是IBitmap
。
您可以阅读更多关于 format of attr in the GAPI mono documentation. There is also some nice bindings documentation in the Xamarin Docs 的内容。
我写了一个关于这个主题的小指南,可能对某些领域有帮助:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb
简而言之,您可以尝试像@Cheesebaron 已经提到的那样更改可见性:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#class-visibility(将 /class 替换为界面或读取公共路径)
否则您可以尝试从头开始添加节点:https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#adding-types
要获得更准确的答案,我相信我们需要查看相应的 .jar/.aar 和当前的 Bindings 项目。