- Home /
Calling static jar function from Unity3D
I made and compiled a Android Library, containing a simple class and a simple static function:
package moo;
public class MyTestClass {
public static String Foo(){
return "Foo from Moo";
}
}
I placed the .jar in my Assets/Plugins/Android Folder. Then In Unity:
void OnGUI () {
string somestring = "foooooooooooOOooo";
AndroidJavaClass testClass = new AndroidJavaClass("moo.MyTestClass");
somestring = testClass.CallStatic<string>("Foo");
GUI.Label (new Rect (20, 20, 100, 20), somestring);
}
And I get an error: JNI: Unable to find method id for 'Foo' (static) UnityEngine.AndroidJavaObject:CallStatic(String, Object[])
Am I missing something to call my static method? Thanks!
Comment