Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
605 views
in Technique[技术] by (71.8m points)

xamarin - Java Binding Abstract class not being generated

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

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.

Java Class:

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

api.xml:

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

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 {

The binding is aware of the interface as it transforming the interface name from Bitmap to 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"?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...