I'm following an online course. It's about JNI. And this code below is in my test.cpp file.
__android_log_print(ANDROID_LOG_ERROR,"testjni JNI: c_str1 = %s", c_str1);
Then it shows "error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]" How should I change it? Thanks!
The full method and implementation
JNIEXPORT jstring JNICALL Java_com_example_carapp_OBOJNI_test_1jni_1api3
(JNIEnv *env, jobject obj, jstring j_str1, jstring j_str2){
const char *c_str1 = NULL;
const char *c_str2 = NULL;
c_str1 = env->GetStringUTFChars(j_str1,0);
__android_log_print(ANDROID_LOG_ERROR,"testjni JNI: c_str1 = %s", c_str1);
env->ReleaseStringUTFChars(j_str1,c_str1);
jstring ret_j_string = env->NewStringUTF("JNI return String");
return ret_j_string;