Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
This repository was archived by the owner on Aug 27, 2026. It is now read-only.

Usage and JNI array questions #264

Description

@mfkl

Hi!

Is this code included in recent Xamarin.Android releases (currently running Xamarin.Android 8.1 and VS 15.5.4)?
I'd assume so, since I can reference types such as JavaTypeParameters which seem to be absent from Xamarin.Android repo and the official Xamarin doc.

Anyways.. I'm stuck on a JNI marshalling issue regarding arrays and thought you could maybe help.

My C lib (which I cannot edit) is making this call:
GET_METHOD(method, "method", "([F)Z", true);
My C# so far looks like this:

[Export]
void method(float[] parameter)
{
}

But it crashes with

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotSupportedException: Only primitive types and IJavaObject is supported in array type in callback method parameter or return value

I have read your helpful post at https://forums.xamarin.com/discussion/1930/creating-arrays-of-custom-java-objects-in-jni and tried several things but can't seem to make it work.

Any idea what pieces I'm missing here?

Thank you for your time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions