App crashing on JNI CallStaticObjectMethod

App crashing on JNI CallStaticObjectMethod
0.0 0


Hello there,

I’m trying to invoke a static method on Android and my app is crashing… the code is very simple, I ran out of ideas — there isn’t much I can think of that might be going on.

Here’s the snippet:

char const FileUtils::cachesDir {
vm = JniHelper::getJavaVM();
JNIEnv env;
int status = vm~~>GetEnv&env, JNI_VERSION_1_4);
jclass cls = env~~>FindClass;
jmethodID method = env~~>GetMethodIDLjava/io/File;");
jobject result = env~~>CallStaticObjectMethod;// <—
* CRASHES WITH java.lang.NullPointerException at android.content.ContextWrapper.getFilesDir******
return “Found a result”;
return “NULL”;

Screenshot here ~~>
Thanks and regards,
~~ Fabiano