Open QiYueFeiXue opened 7 years ago
I also experienced the same problem. For the other people who encountered this problem, here is the solution: Just re-generate test constants definition file with following commands:
src/test/bin/generate_test_constants.sh src/test/data/TestConstants.txt src/test/cpp/TestConstants.h src/test/java/com/spotify/jni/TestConstants.java
This command generates TestConstants.h
and TestConstants.java
which defines TEST_INTEGER
etc from TestConstants.txt
. Originally, they are not included in the source tree so you need to generate them. It sometimes generated improperly (I don't know why) so you need to regenerate them.
After giving above commands, You can now build the project without any problem.
It sometimes generated improperly, if you build failed, you should add manually like: `#define TEST_STRING "hello, is it me you're looking for?"
// #define TEST_CHAR 'ö' JAVA
public class TestConstants { public static final String TEST_STRING = "hello, is it me you're looking for?"; public static final String TEST_NULL_CHAR = "\0"; public static final String TEST_STRING_WITH_NULL_CHAR = "hello \0 world"; public static final String TEST_UTF16_STRING = "UTF16 hello: \u2018."; public static final String TEST_UTF8_STRING = "a \u0915\u093E\u091A\u0902 \u00F6 1 2 3"; public static final int TEST_INTEGER = 42; public static final short TEST_SHORT = 777; public static final boolean TEST_BOOLEAN = true; public static final float TEST_FLOAT = 3.14159f; public static final double TEST_FLOAT_TOLERANCE = 0.01; public static final double TEST_DOUBLE = 2.71828; public static final byte TEST_BYTE = 72; public static final char TEST_CHAR = 'a'; // public static final char TEST_CHAR L'ö' CPP }
in src/test/cpp/TestConstants.h and src/test/java/com/spotify/jni/TestConstants.java
also, you should add JNI_INCLUDE_DIRS JNI_LIBRARIES environment variable
hello, I followed your comand line, but find this error: JniHelpers/src/test/cpp/NativeObjectTest.cpp:49:24: error: ‘TEST_INTEGER’ was not declared in this scope