Android JNI error: format string is not a string literal
mob 发布于 2023-09-23

在Android JNI中调用__android_log_print,

 const char *pathur = env->GetStringUTFChars(path,nullptr);

    __android_log_print(ANDROID_LOG_DEBUG, "Test", pathur);

出现了error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]

改为

__android_log_print(ANDROID_LOG_DEBUG, "Test", “%s”, path);

就不会出现错误

mob
关注 私信
文章
61
关注
0
粉丝
0