Hi,
I'm tracking some bugs in an application and found some strange behavior with the function getenv().
It returns automatically null.
I tried with variables USER and TMPDIR, the result remains the same.
This issue occurs on Android 6 and 7, with clang and gcc.
My code is below :
JNIEXPORT jstring JNICALL
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
jobject thiz )
{
char *tmp = NULL;
/* Get temp dir */
tmp = getenv("TMPDIR");
__android_log_print(ANDROID_LOG_INFO, "ProcTest", "User is located in %s", tmp);
return (*env)->NewStringUTF(env, "getenv unit test .");
}
Jerome