locked
Binding Library Error: How to make a method return an array of IDictionary <TKey, TValue>? RRS feed

  • Question

  • User392293 posted

    I am getting an error when I import a .aar file to integrate with a machine service.

    My question is as per the title.

    This the code I am trying to get:

    ``` [Register ("getSlots", "()[Ljava/util/HashMap;", "")] public unsafe global::System.Collections.Generic.IDictionary [] GetSlots () { const string id = "getSlots.()[Ljava/util/HashMap;"; try { var _rm = _members.InstanceMethods.InvokeNonvirtualObjectMethod (id, this, null); return (global::System.Collections.Generic.IDictionary[]) JNIEnv.GetArray (_rm.Handle, JniHandleOwnership.TransferLocalRef, typeof (global::System.Collections.Generic.IDictionary)); } finally { } }

    ```

    This is the code I am getting:

    [Register ("getSlots", "()[Ljava/util/HashMap;", "")] public unsafe global::System.Collections.Generic.IDictionary <string, byte[]>GetSlots () { const string __id = "getSlots.()[Ljava/util/HashMap;"; try { var __rm = _members.InstanceMethods.InvokeNonvirtualObjectMethod (__id, this, null); return (global::System.Collections.Generic.IDictionary<string, byte[]>[]) JNIEnv.GetArray (__rm.Handle, JniHandleOwnership.TransferLocalRef, typeof (global::System.Collections.Generic.IDictionary<string, byte[]>)); } finally { } }

    I need a method that returns an array IDictionary <string, byte[]>[], but I am getting IDictionary <string, byte[]>

    This is the code that is in metadata.xml

    <attr path="/api/package[@name='br.com.uol.pagseguro.plugpagservice.wrapper']/class[@name='PlugPagNFCResult']/method[@name='getSlots' and count(parameter)=0]" name="managedReturn">System.Collections.Generic.IDictionary &lt;string, byte[]&gt;</attr>

    But every time I write "[]", after ">", it doesn't appear to form an array!

    Could you help me with this?

    Friday, January 17, 2020 1:29 PM

All replies

  • User395622 posted

    Hi, did you manage to resolve this issue? I am facing the same problem

    Monday, July 6, 2020 5:34 PM
  • User392293 posted

    Hello, I managed to solve this problem as follows. I in the .aar file I define the return as a list of Dictionary

    Tuesday, July 14, 2020 3:46 PM
  • User392293 posted

    IList>

    Tuesday, July 14, 2020 3:47 PM