- Home /
AndroidJavaObject.Call array passing error
I'm working on Unity for Android application, which uses native Android plugin. Inside of it I use AndroidJavaObject
's Call
method.
As it says in documentation, signature of method is:
public void Call(string methodName, params object[] args);
I want to send array of strings into my project:
string[] strings = new string[] { "string1", "string2", ...};
myAndroidJavaObject.Call("myMethod", strings);
And receive it into Java code:
public void myMethod(String[] strings){
// some code where I use strings
}
But I receive error:
AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='myMethod' signature='(Ljava/lang/String;Ljava/lang/String;)V' in class Ljava.lang.Object;
Can anyone describe program's behavior in this situation?
The error message tells you that you're attempting to invoke a non static method called my$$anonymous$$ethod with a specific signature (this is the JNI notation for describing method signatures). This corresponds to a native Java method that looks like this: public void my$$anonymous$$ethod(String a, String b)
you should make sure that such a method exists and that the code that defines it is also included in your project so it gets built.
Your answer
Follow this Question
Related Questions
Android Share text and image? 4 Answers
How do I override an Android Java class in Unity? 1 Answer
Opening files/URLs with an Unity App in Android 0 Answers
Android: Intent extras not being received when launching an already-open UnityPlayerNativeActivity 0 Answers
How do I use Java callbacks? 1 Answer