Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Forms Android Binding library error

I am currently facing an issue about Xamarin Forms Android Bindings library. I've put a .jar library inside my bindings project and I realize that the library is not fully loaded.

When I build my bindings project it compiles properly but I still have some warnings in my output.

1>BINDINGSGENERATOR : warning BG8102: Class Java.Util.LinkedHashMap has unknown base type Java.Util.HashMap.

1>BINDINGSGENERATOR : warning BG8103: Class Com.MyParams has invalid base type java.util.LinkedHashMap.

1>BINDINGSGENERATOR : warning BG8701: Invalid return type com.MyParams in method GetParams in managed type Com.TagOp.

1>BINDINGSGENERATOR : warning BG8801: Invalid parameter type com.MyParams in method TagOps in managed type Com.TagOp.

1>BINDINGSGENERATOR : warning BG8801: Invalid parameter type com.MyParams in method TagOps in managed type Com.TagOp.

1>BINDINGSGENERATOR : warning BG8801: Invalid parameter type com.MyParams in method TagPage in managed type Com.Tag.

In my Android code I can't use the Com.MyParams class because it's not loaded.

This problem occurs since the update of Xamarin for Visual Studio 2017.

Do you have any leads to solve this problem ? Thanks in advance.

like image 806
Eastrall Avatar asked Jul 05 '17 11:07

Eastrall


1 Answers

HashMap & LinkedHashMap are not known ...therefore nothing based upon them can be instanced.

When the data-binding does not know a class, then it either lacks the annotations, it might not extend class BaseObservable and/or has wrongful get / set method names (which need to match the name of the field); there are quite a few conditions to meet, depending if one-way or two-way data-binding is required. Reviewing the generated code often gives a clue what one has to change.

However, directly data-binding the JAR classes does not even appear possible, unless adding the required annotations into them and then building the JAR, in order to have them bind-able. The documentation of the Android Data Binding Library and Xamarin Java Bindings Metadata explains it (replicating the required Java classes from scratch, perfectly bind-able, might be the most fast-forward, if not the only way).

One can only work around it, by substituting the classes to be bound to the GUI - which is possible with rather simple classes, or when using a Java decompiler (in order to know the fields to use).

like image 69
Martin Zeitler Avatar answered Oct 23 '22 13:10

Martin Zeitler