jclass regionClass = env - >FindClass("com/oppo/util/RfUtils"); //查找java类
if (regionClass != 0) {
jmethodID mid;
mid = env - >GetStaticMethodID(regionClass, "getPrjVersion", "()Ljava/lang/String;"); //查找java方法
if (mid != 0) {
jstring size = (jstring) env - >CallStaticObjectMethod(regionClass, mid); //调用ava方法
char * mysize = (char * ) env - >GetStringUTFChars(size, NULL); //转换jstring为char用于显示
LOGI("jni a=%s", mysize);
} else {
LOGI("method not find");
}
java函数原型 类名是com.oppo.util.RfUtils
public static String getPrjVersion() {
if (read_once == false) {
initCdtValue();
read_once = true;
}
return mPrjVersion;
}