Open Zomb opened 6 years ago
Hey, arrays are still not supported in Java. It's the next feature to be supported (PR https://github.com/mono/Embeddinator-4000/pull/508).
Great! My current workaround for anyone else who runs into this right now is convert the array into a Base64String and back again.
var fromBase64String = Convert.FromBase64String(data);
Actually, looking again at the stack trace, this error seems related to arrays in Java.Lang.Object derived types, right? If that's the case, then my PR only implements support for non-Java.Lang.Object derived C# types.
Yes, the C# class that contains this derives from Java.Lang.Object because it needs to run on a background thread, and that's the only way to make that work according to @jonathanpeppers as documented in #439. Would this be a bug then? Or a new feature request?
I changed the title to track the issue more accurately. Not sure when this might be fixed though because it's not a limitation of Embeddinator generator itself but of the interop generator from Xamarin.Android.
Okay! In the change that you made, you said 'non-primitive array types' but I am running into the issue when my array is of type byte or int. I haven't tried using non-primitive types in an array.
I was going through the exception message in the trace you posted: Only primitive types and IJavaObject is supported in array type in callback method parameter or return value
.
Maybe this is not accurate after all?
Yes, it says primitive types are allowed, but when I use a primitive type it errors out, and I was not sure why.
@Zomb I'll try this out next week and write a test for it. I vaguely remember seeing something that was fixed in this area in Xamarin.Android.
So updating Xamarin.Android might fix it:
external/Xamarin.Android
folder completely would be niceOf course if it's still broken on XA master, I can ask the right people.
Any news about this? Any workaround?
I get the same message on Xamarin.Android Only primitive types and IJavaObject is supported in array type in callback method parameter or return value
. Need to expose a method that has an array of float as parameter.
Thanks!
If I use an array as an argument for a C# method, for example:
or
e4k completes successfully and generates the aar. Once I include it in my AS project and run the app, I get the following exception. I am using primitives as my type, so I am not sure what is causing the issue.