在android中调用JNI方法时崩溃

在android中调用JNI方法时崩溃,android,Android,我正在调用initPath方法,结果出现了一个崩溃,只出现在带API 16的三星galaxy选项卡中。谁能告诉我我做错了什么。方法是- JNIEXPORT void JNICALL Java_com_example_prat_render_GLLib_initPath (JNIEnv *env,jobject obj, jstring name) { const char *str= (*env).GetStringUTFChars(name,0); FilePath::fold

我正在调用
initPath
方法,结果出现了一个崩溃,只出现在带API 16的三星galaxy选项卡中。谁能告诉我我做错了什么。方法是-

JNIEXPORT void JNICALL Java_com_example_prat_render_GLLib_initPath (JNIEnv *env,jobject obj, jstring name) {
    const char *str= (*env).GetStringUTFChars(name,0);
    FilePath::folderPath = std::string(str); //Crashes at this line
    FilePath::folderPath.c_str());
    (*env).ReleaseStringUTFChars( name, str); 
}

首先,您能在没有FilePath::folderPath的情况下运行它吗?通过这种方式,我们可以检查问题是在JNI转换中,还是在分配给“folderPath”时。 你能不能也用安卓日志写下“str”的内容(安卓日志错误,“标签”,“错误消息”)


接下来的步骤将取决于上述检查的结果。

是否有任何崩溃日志要显示?A/libc:@@@ABORTING:dlfree addr=0x5e94e454中的堆地址无效A/libc:0xdeadbaad(code=1)处的致命信号11(SIGSEGV),线程23592是否有人可以帮助我。我已经添加了崩溃日志。它只是给出了无效的堆地址。如果它在地址0xdeadbaad处失败,VM会故意中止。崩溃前的logcat输出应该解释VM决定退出的原因。