使用 JNI 调用 Java 方法时的 "Method Signature" 参数是什么?

What's "Method Signature" parameter when calling a Java method using JNI?

我想在 Qt 中使用 JNI 调用 Android Java 方法。有一个奇怪的 "Method Signature" 参数我无法理解。这是什么,我应该如何设置它?

在示例中,它类似于 (II)I(I)I。这是什么意思?

例如:

jint max = QAndroidJniObject::callStaticMethod<jint>("java/lang/Math", "max", "(II)I", a, b);

文档里都有解释。 http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html

Type Signature   Java Type
Z                boolean
B                byte
C                char
S                short
I                int
J                long
F                float
D                double
L fully-qualified-class ;   fully-qualified-class
[ type           type[]
( arg-types ) ret-type method type

您的 (II)I 是一种将两个整数作为参数并返回一个 int 的方法。例如。 int m(int i, int j).

方法 void print(String message) 将是 (Ljava/lang/String;)