Json::CharReader failed to parse json string on Android
I had built jsoncpp by NDK(both ndk-r10e and ndk-r16e). LOCAL_CFLAGS := -fexceptions -std=c++11 -DJSONCPP_NO_LOCALE_SUPPORT -D__ANDROID__.
The following is my test code.
Json::CharReaderBuilder builder; Json::CharReader *reader = builder.newCharReader(); Json::Value value; string err; std::string tt = "{"face":1}"; int ll = tt.length(); if (reader->parse(json.c_str(), json.c_str() + json.length(), &value, &err)) { }
which was crash when calling the API of parse.
I think I may build the library something wrong. Since I test it in Android studio by Cmake method(the CFLAGS is same), it works fine. But I still can not find the reason.
Did you figure it out what may have been wrong? I'm having exact same issue, I use NDK14 to compile the jsoncpp as shared library, but whenever I called reader->parse(), system crash. Exact same code works fine on just pure linux environment.