[英]Android JNI error: Call function with boolean argument causes a crash
I'm Trying to call this JAVA
function: 我正在尝试调用此JAVA
函数:
public String getPreferredLanguage(boolean withRegion)
With JNI
GetMethodID
, But i always get a crash, i tried a lot of variations about the function signature in the JNI
section, but none seemed to be helping. 使用JNI
GetMethodID
,但是我总是崩溃,我在JNI
部分尝试了很多有关函数签名的变体,但是似乎没有用。
The JNI
code: JNI
代码:
methodID getPreferredLanguageMethod = env->GetMethodID(languageServiceClass, "getPreferredLanguage", "(Ljava/lang/Boolean;Z)Ljava/lang/String;");
if (!getPreferredLanguageMethod) {
TTLOGD("LanguageService::getPreferredLanguage: ERROR getPreferredLanguageMethod is null\n");
}
The crash message: 崩溃消息:
JNI DETECTED ERROR IN APPLICATION: JNI CallObjectMethodV called with pending exception java.lang.NoSuchMethodError: no non-static method "Lcom/tabtale/mobile/acs/services/LanguageService;.getPreferredLanguage(Ljava/lang/Boolean;Z)Ljava/lang/String;"
Any idea what i'm doing wrong? 知道我在做什么错吗?
一遍又一遍地阅读此文档后,我发现了我的问题,这就是JNI
函数应为的方式:
jmethodID getPreferredLanguageMethod = env->GetMethodID(languageServiceClass, "getPreferredLanguage", "(Z)Ljava/lang/String;");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.