Try using JAVAP to establish the correct list of parameters, as the ones you list for the method and the ones in the native call have no match.
IIRC it's the "-s" parameter you want to use, along with the jar path (in class path) and the class name, but it's a while since I used it. Get the right format and it will spit out the exact JNI parameter format for you though. Regards, James Burton From: [email protected] [mailto:[email protected]] On Behalf Of Hänke, Maik Sent: 20 March 2012 2:11 PM To: [email protected] Subject: [mono-android] JniEnv problem Hi, I try to use a 3rd party library with JNI. I have the following java method header: public static native int Msg_UpdateOptions(int lIdentifier, boolean bEnabled, boolean bQueue, String functionName, int convention, Object callBackObj); I import the method with this code: public static int Msg_UpdateOptions(uint lIdentifier, bool bEnabled, bool bQueue, String functionName, int convention, Java.Lang.Object callBackObj) { IntPtr methodId = JNIEnv.GetStaticMethodID(mAlkClass, "Msg_UpdateOptions", "(IZZLjava/lang/String;ILjava/lang/Object;)I"); return JNIEnv.CallStaticIntMethod(mAlkClass, methodId, new JValue[] { new JValue(lIdentifier), new JValue(bEnabled), new JValue(bQueue), new JValue(new Java.Lang.String(functionName)), new JValue(convention), new JValue(callBackObj) }); } In the Java sample the method is used in this way: Msg_UpdateOptions(AlkMsg.MSG_ID_TurnInstructions, true, false, "OnTurnInstructionReceived", 0, this ); Where 'this' is an activity and OnTurnInstructionReceived is a method of the actvity. public void OnTurnInstructionReceived(int buffer, int len) { } When I try this in c#, my app crashes without an error. I think the library try to call my OnTurnInstructionReceived method. Does anyone have an idea what is wrong?
_______________________________________________ Monodroid mailing list [email protected] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
