I have gradle app module:
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
with CMakeLists.txt:
cmake_minimum_required(VERSION 3.4.1)
add_library( # Sets the name of the library.
native-lib
SHARED
src/main/cpp/native-lib.cpp )
add_library( # Sets the name of the library.
keys
SHARED
src/main/cpp/keys.cpp )
find_library( # Sets the name of the path variable.
log-lib
log )
target_link_libraries( # Specifies the target library.
native-lib
${log-lib} )
and keys.cpp:
#include <jni.h>
JNIEXPORT jstring JNICALL
Java_com_my_app_App_getApplicationKey(JNIEnv *env, jobject instance) {
return (*env)-> NewStringUTF(env, "PuTy0uR4Ppl1C4TioNk3yH3re");
}
i keep encountering below in my cpp:
Error:(5, 18) error: member reference type 'JNIEnv' (aka '_JNIEnv') is not a pointer; did you mean to use '.'?
or if i roll over my mouse in Android studio it said:
Applying '->' operator to JNIEnv instead of a pointer
what am I missing here, NewStringUTF is part of jni.h library, but why it didn't 'link-up'?