如何传递一个字符串数组?
xx.cpp
JNIEXPORT jstring JNICALL Hello_Native(JNIEnv *env, jobject obj,jstring string)
{
const char *str = env->GetStringUTFChars(string, 0);
return env->NewStringUTF( "Hello from JNI !");
}
static JNINativeMethod gMethods[] = {
{"JniHello",const_cast<char*>("(Ljava/lang/jsting)Ljava/lang/jsting;"),(void*)Hello_Native}
xx.java
public native static String JniHello(String text);
为什么系统总是提醒当在 gMethods 中申明 JniHello 时,参数不正确。