I have my JNI header file implementation as shown below
apptester.java:
public native boolean bool1(Vector<Byte>filepath);
The reason I declared it as Byte because according to javadocs, it says 8-bit int can be declared as byte.
byte: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. They can also be used in place of int where their limits help to clarify your code; the fact that a variable's range is limited can serve as a form of documentation.
This is my c++ code:
JNIEXPORT jboolean JNICALL Java_app_Tester_bool1
(JNIEnv*, jobject, jbyteArrayfilepath) {
//codes...
myProxy->bool1(filepath, callStatus, retcode);
//codes...
if (retcode == 0) {
status = true;
return status;
} else {
return status;
}
}
Now, in my c++ editor it shows error something like this -> no suitable constructor exists to convert from "jobject" to "std::vector<uint8_t, std::allocator<uint8_t>>
Originally the c++ code is expecting std::vector<uint8_t>filepath;
.
I am not really sure how to convert jobject to vector type. Are there anyone who can help me out with this error.